home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document, ASCII text
| default
| |
100%
| TrID
| Delphi Project source (with rem)
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 7b 5c 6d 61 67 6f 6e 65 | 62 66 20 20 36 2e 37 20 |{\magone|bf 6.7 |
|00000010| 47 72 61 70 68 69 63 20 | 57 69 6e 64 6f 77 73 20 |Graphic |Windows |
|00000020| 28 77 69 6e 64 6f 77 29 | 7d 0a 0a 7b 5c 62 66 20 |(window)|}..{\bf |
|00000030| 31 2e 20 44 65 66 69 6e | 69 74 69 6f 6e 7d 0a 0a |1. Defin|ition}..|
|00000040| 54 68 65 20 64 61 74 61 | 20 74 79 70 65 20 24 77 |The data| type $w|
|00000050| 69 6e 64 6f 77 24 20 70 | 72 6f 76 69 64 65 73 20 |indow$ p|rovides |
|00000060| 61 6e 20 69 6e 74 65 72 | 66 61 63 65 20 66 6f 72 |an inter|face for|
|00000070| 20 74 68 65 20 69 6e 70 | 75 74 20 61 6e 64 20 0a | the inp|ut and .|
|00000080| 6f 75 74 70 75 74 20 6f | 66 20 62 61 73 69 63 20 |output o|f basic |
|00000090| 74 77 6f 2d 64 69 6d 65 | 6e 73 69 6f 6e 61 6c 20 |two-dime|nsional |
|000000a0| 67 65 6f 6d 65 74 72 69 | 63 20 6f 62 6a 65 63 74 |geometri|c object|
|000000b0| 73 20 28 63 66 2e 7e 73 | 65 63 74 69 6f 6e 20 35 |s (cf.~s|ection 5|
|000000c0| 2e 31 29 20 75 73 69 6e | 67 20 74 68 65 20 0a 58 |.1) usin|g the .X|
|000000d0| 31 31 20 6f 72 20 53 75 | 6e 56 69 65 77 20 77 69 |11 or Su|nView wi|
|000000e0| 6e 64 6f 77 20 73 79 73 | 74 65 6d 2e 20 54 68 65 |ndow sys|tem. The|
|000000f0| 72 65 20 61 72 65 20 74 | 77 6f 20 6f 62 6a 65 63 |re are t|wo objec|
|00000100| 74 20 63 6f 64 65 20 6c | 69 62 72 61 72 69 65 73 |t code l|ibraries|
|00000110| 20 6c 69 62 57 78 31 31 | 2e 61 2c 20 0a 61 6e 64 | libWx11|.a, .and|
|00000120| 20 6c 69 62 57 78 76 69 | 65 77 2e 61 20 63 6f 6e | libWxvi|ew.a con|
|00000130| 74 61 69 6e 69 6e 67 20 | 69 6d 70 6c 65 6d 65 6e |taining |implemen|
|00000140| 74 61 74 69 6f 6e 73 20 | 66 6f 72 20 62 6f 74 68 |tations |for both|
|00000150| 20 74 68 65 20 62 61 73 | 69 63 20 58 31 31 20 61 | the bas|ic X11 a|
|00000160| 6e 64 20 74 68 65 20 78 | 76 69 65 77 20 0a 65 6e |nd the x|view .en|
|00000170| 76 69 72 6f 6e 6d 65 6e | 74 73 2e 20 41 70 70 6c |vironmen|ts. Appl|
|00000180| 69 63 61 74 69 6f 6e 20 | 70 72 6f 67 72 61 6d 73 |ication |programs|
|00000190| 20 75 73 69 6e 67 20 64 | 61 74 61 20 74 79 70 65 | using d|ata type|
|000001a0| 20 24 77 69 6e 64 6f 77 | 24 20 68 61 76 65 20 74 | $window|$ have t|
|000001b0| 6f 20 0a 62 65 20 6c 69 | 6e 6b 65 64 20 77 69 74 |o .be li|nked wit|
|000001c0| 68 20 6f 6e 65 20 6f 66 | 20 74 68 65 73 65 20 6c |h one of| these l|
|000001d0| 69 62 72 61 72 69 65 73 | 20 28 63 66 2e 7e 73 65 |ibraries| (cf.~se|
|000001e0| 63 74 69 6f 6e 7e 31 2e | 36 29 3a 0a 0a 5c 62 65 |ction~1.|6):..\be|
|000001f0| 67 69 6e 69 74 65 6d 0a | 5c 69 74 65 6d 7b 20 61 |ginitem.|\item{ a|
|00000200| 29 7d 20 0a 46 6f 72 20 | 74 68 65 20 58 31 31 20 |)} .For |the X11 |
|00000210| 77 69 6e 64 6f 77 20 73 | 79 73 74 65 6d 3a 5c 6e |window s|ystem:\n|
|00000220| 6c 0a 43 43 20 24 70 72 | 6f 67 2e 63 24 20 2d 6c |l.CC $pr|og.c$ -l|
|00000230| 50 20 2d 6c 47 20 2d 6c | 4c 20 2d 6c 57 78 31 31 |P -lG -l|L -lWx11|
|00000240| 20 2d 6c 58 31 31 20 2d | 6c 6d 0a 0a 5c 69 74 65 | -lX11 -|lm..\ite|
|00000250| 6d 7b 20 62 29 7d 20 0a | 46 6f 72 20 74 68 65 20 |m{ b)} .|For the |
|00000260| 78 76 69 65 77 20 65 6e | 76 69 72 6f 6e 6d 65 6e |xview en|vironmen|
|00000270| 74 3a 5c 6e 6c 0a 43 43 | 20 24 70 72 6f 67 2e 63 |t:\nl.CC| $prog.c|
|00000280| 24 20 2d 6c 50 20 2d 6c | 47 20 2d 6c 4c 20 2d 6c |$ -lP -l|G -lL -l|
|00000290| 57 78 31 31 20 2d 6c 78 | 76 69 65 77 20 2d 6c 6f |Wx11 -lx|view -lo|
|000002a0| 6c 67 78 20 2d 6c 58 31 | 31 20 2d 6c 6d 0a 5c 65 |lgx -lX1|1 -lm.\e|
|000002b0| 6e 64 69 74 65 6d 0a 0a | 0a 41 6e 20 69 6e 73 74 |nditem..|.An inst|
|000002c0| 61 6e 63 65 20 24 57 24 | 20 6f 66 20 74 68 65 20 |ance $W$| of the |
|000002d0| 64 61 74 61 20 74 79 70 | 65 20 24 77 69 6e 64 6f |data typ|e $windo|
|000002e0| 77 24 20 69 73 20 61 6e | 20 69 73 6f 2d 6f 72 69 |w$ is an| iso-ori|
|000002f0| 65 6e 74 65 64 20 0a 72 | 65 63 74 61 6e 67 75 6c |ented .r|ectangul|
|00000300| 61 72 20 77 69 6e 64 6f | 77 20 69 6e 20 74 68 65 |ar windo|w in the|
|00000310| 20 74 77 6f 2d 64 69 6d | 65 6e 73 69 6f 6e 61 6c | two-dim|ensional|
|00000320| 20 70 6c 61 6e 65 2e 20 | 0a 54 68 65 20 64 65 66 | plane. |.The def|
|00000330| 61 75 6c 74 20 72 65 70 | 72 65 73 65 6e 74 61 74 |ault rep|resentat|
|00000340| 69 6f 6e 20 6f 66 20 24 | 57 24 20 6f 6e 20 74 68 |ion of $|W$ on th|
|00000350| 65 20 73 63 72 65 65 6e | 20 69 73 20 61 20 38 35 |e screen| is a 85|
|00000360| 30 20 24 5c 74 69 6d 65 | 73 24 20 38 35 30 20 70 |0 $\time|s$ 850 p|
|00000370| 69 78 65 6c 0a 73 71 75 | 61 72 65 20 70 6f 73 69 |ixel.squ|are posi|
|00000380| 74 69 6f 6e 65 64 20 69 | 6e 20 74 68 65 20 75 70 |tioned i|n the up|
|00000390| 70 65 72 20 72 69 67 68 | 74 20 63 6f 72 6e 65 72 |per righ|t corner|
|000003a0| 20 28 63 66 2e 7e 63 72 | 65 61 74 69 6f 6e 2c 20 | (cf.~cr|eation, |
|000003b0| 76 61 72 69 61 6e 74 20 | 63 29 29 2e 0a 54 68 65 |variant |c))..The|
|000003c0| 20 63 6f 6f 72 64 69 6e | 61 74 65 73 20 61 6e 64 | coordin|ates and|
|000003d0| 20 73 63 61 6c 69 6e 67 | 20 6f 66 20 24 57 24 20 | scaling| of $W$ |
|000003e0| 75 73 65 64 20 66 6f 72 | 20 64 72 61 77 69 6e 67 |used for| drawing|
|000003f0| 20 6f 70 65 72 61 74 69 | 6f 6e 73 20 61 72 65 20 | operati|ons are |
|00000400| 64 65 66 69 6e 65 64 20 | 0a 62 79 20 74 68 72 65 |defined |.by thre|
|00000410| 65 20 64 6f 75 62 6c 65 | 20 70 61 72 61 6d 65 74 |e double| paramet|
|00000420| 65 72 73 3a 20 0a 24 78 | 5f 30 24 2c 20 74 68 65 |ers: .$x|_0$, the|
|00000430| 20 78 2d 63 6f 6f 72 64 | 69 6e 61 74 65 20 6f 66 | x-coord|inate of|
|00000440| 20 74 68 65 20 6c 65 66 | 74 20 73 69 64 65 2c 20 | the lef|t side, |
|00000450| 24 78 5f 31 24 2c 20 74 | 68 65 20 78 2d 63 6f 6f |$x_1$, t|he x-coo|
|00000460| 72 64 69 6e 61 74 65 20 | 6f 66 20 74 68 65 20 72 |rdinate |of the r|
|00000470| 69 67 68 74 20 0a 73 69 | 64 65 2c 20 61 6e 64 20 |ight .si|de, and |
|00000480| 24 79 5f 30 24 2c 20 74 | 68 65 20 79 2d 63 6f 6f |$y_0$, t|he y-coo|
|00000490| 72 64 69 6e 61 74 65 20 | 6f 66 20 74 68 65 20 62 |rdinate |of the b|
|000004a0| 6f 74 74 6f 6d 20 73 69 | 64 65 2e 20 0a 54 68 65 |ottom si|de. .The|
|000004b0| 20 79 2d 63 6f 6f 72 64 | 69 6e 61 74 65 20 6f 66 | y-coord|inate of|
|000004c0| 20 74 68 65 20 74 6f 70 | 20 73 69 64 65 20 6f 66 | the top| side of|
|000004d0| 20 24 57 24 20 69 73 20 | 64 65 74 65 72 6d 69 6e | $W$ is |determin|
|000004e0| 65 64 20 62 79 20 74 68 | 65 20 63 75 72 72 65 6e |ed by th|e curren|
|000004f0| 74 20 73 69 7a 65 20 61 | 6e 64 20 0a 73 68 61 70 |t size a|nd .shap|
|00000500| 65 20 6f 66 20 74 68 65 | 20 77 69 6e 64 6f 77 20 |e of the| window |
|00000510| 6f 6e 20 74 68 65 20 73 | 63 72 65 65 6e 2c 20 77 |on the s|creen, w|
|00000520| 68 69 63 68 20 63 61 6e | 20 62 65 20 63 68 61 6e |hich can| be chan|
|00000530| 67 65 64 20 69 6e 74 65 | 72 61 63 74 69 76 65 6c |ged inte|ractivel|
|00000540| 79 2e 20 0a 41 20 67 72 | 61 70 68 69 63 20 77 69 |y. .A gr|aphic wi|
|00000550| 6e 64 6f 77 20 73 75 70 | 70 6f 72 74 73 20 6f 70 |ndow sup|ports op|
|00000560| 65 72 61 74 69 6f 6e 73 | 20 66 6f 72 20 64 72 61 |erations| for dra|
|00000570| 77 69 6e 67 20 70 6f 69 | 6e 74 73 2c 20 6c 69 6e |wing poi|nts, lin|
|00000580| 65 73 2c 20 73 65 67 6d | 65 6e 74 73 2c 20 0a 61 |es, segm|ents, .a|
|00000590| 72 72 6f 77 73 2c 20 63 | 69 72 63 6c 65 73 2c 20 |rrows, c|ircles, |
|000005a0| 70 6f 6c 79 67 6f 6e 73 | 2c 20 67 72 61 70 68 73 |polygons|, graphs|
|000005b0| 2c 20 5c 64 6f 74 73 20 | 61 6e 64 20 66 6f 72 20 |, \dots |and for |
|000005c0| 67 72 61 70 68 69 63 61 | 6c 20 69 6e 70 75 74 20 |graphica|l input |
|000005d0| 6f 66 20 61 6c 6c 20 74 | 68 65 73 65 20 0a 6f 62 |of all t|hese .ob|
|000005e0| 6a 65 63 74 73 20 75 73 | 69 6e 67 20 74 68 65 20 |jects us|ing the |
|000005f0| 6d 6f 75 73 65 20 69 6e | 70 75 74 20 64 65 76 69 |mouse in|put devi|
|00000600| 63 65 2e 20 4d 6f 73 74 | 20 6f 66 20 74 68 65 20 |ce. Most| of the |
|00000610| 64 72 61 77 69 6e 67 20 | 6f 70 65 72 61 74 69 6f |drawing |operatio|
|00000620| 6e 73 20 68 61 76 65 20 | 61 6e 20 0a 6f 70 74 69 |ns have |an .opti|
|00000630| 6f 6e 61 6c 20 63 6f 6c | 6f 72 20 61 72 67 75 6d |onal col|or argum|
|00000640| 65 6e 74 2e 20 50 6f 73 | 73 69 62 6c 65 20 63 6f |ent. Pos|sible co|
|00000650| 6c 6f 72 73 20 61 72 65 | 20 24 62 6c 61 63 6b 24 |lors are| $black$|
|00000660| 20 28 64 65 66 61 75 6c | 74 29 2c 20 24 77 68 69 | (defaul|t), $whi|
|00000670| 74 65 24 2c 0a 24 62 6c | 75 65 24 2c 20 24 67 72 |te$,.$bl|ue$, $gr|
|00000680| 65 65 6e 24 2c 20 24 72 | 65 64 24 2c 20 24 76 69 |een$, $r|ed$, $vi|
|00000690| 6f 6c 65 74 24 2c 20 61 | 6e 64 20 24 6f 72 61 6e |olet$, a|nd $oran|
|000006a0| 67 65 24 2e 20 4f 6e 20 | 6d 6f 6e 6f 63 68 72 6f |ge$. On |monochro|
|000006b0| 6d 65 20 64 69 73 70 6c | 61 79 73 20 61 6c 6c 20 |me displ|ays all |
|000006c0| 0a 63 6f 6c 6f 72 73 20 | 64 69 66 66 65 72 65 6e |.colors |differen|
|000006d0| 74 20 66 72 6f 6d 20 24 | 77 68 69 74 65 24 20 61 |t from $|white$ a|
|000006e0| 72 65 20 74 75 72 6e 65 | 64 20 74 6f 20 24 62 6c |re turne|d to $bl|
|000006f0| 61 63 6b 24 2e 20 54 68 | 65 72 65 20 61 72 65 20 |ack$. Th|ere are |
|00000700| 36 20 70 61 72 61 6d 65 | 74 65 72 73 20 0a 75 73 |6 parame|ters .us|
|00000710| 65 64 20 62 79 20 74 68 | 65 20 64 72 61 77 69 6e |ed by th|e drawin|
|00000720| 67 20 6f 70 65 72 61 74 | 69 6f 6e 73 3a 0a 5c 62 |g operat|ions:.\b|
|00000730| 65 67 69 6e 69 74 65 6d | 0a 5c 69 74 65 6d 20 7b |eginitem|.\item {|
|00000740| 31 2e 20 7d 20 0a 54 68 | 65 20 7b 5c 73 6c 20 6c |1. } .Th|e {\sl l|
|00000750| 69 6e 65 20 77 69 64 74 | 68 7d 20 70 61 72 61 6d |ine widt|h} param|
|00000760| 65 74 65 72 20 28 64 65 | 66 61 75 6c 74 20 76 61 |eter (de|fault va|
|00000770| 6c 75 65 20 31 20 70 69 | 78 65 6c 29 20 64 65 66 |lue 1 pi|xel) def|
|00000780| 69 6e 65 73 20 74 68 65 | 20 77 69 64 74 68 20 6f |ines the| width o|
|00000790| 66 20 61 6c 6c 20 0a 6b | 69 6e 64 73 20 6f 66 20 |f all .k|inds of |
|000007a0| 6c 69 6e 65 73 20 28 73 | 65 67 6d 65 6e 74 73 2c |lines (s|egments,|
|000007b0| 20 61 72 72 6f 77 73 2c | 20 65 64 67 65 73 2c 20 | arrows,| edges, |
|000007c0| 63 69 72 63 6c 65 73 2c | 20 70 6f 6c 79 67 6f 6e |circles,| polygon|
|000007d0| 73 29 2e 20 0a 0a 5c 69 | 74 65 6d 20 7b 32 2e 20 |s). ..\i|tem {2. |
|000007e0| 7d 0a 54 68 65 20 7b 5c | 73 6c 20 6c 69 6e 65 20 |}.The {\|sl line |
|000007f0| 73 74 79 6c 65 7d 20 70 | 61 72 61 6d 65 74 65 72 |style} p|arameter|
|00000800| 20 64 65 66 69 6e 65 73 | 20 74 68 65 20 73 74 79 | defines| the sty|
|00000810| 6c 65 20 6f 66 20 6c 69 | 6e 65 73 2e 20 50 6f 73 |le of li|nes. Pos|
|00000820| 73 69 62 6c 65 20 6c 69 | 6e 65 20 0a 73 74 79 6c |sible li|ne .styl|
|00000830| 65 73 20 61 72 65 20 24 | 73 6f 6c 69 64 24 20 28 |es are $|solid$ (|
|00000840| 64 65 66 61 75 6c 74 29 | 2c 20 24 64 61 73 68 65 |default)|, $dashe|
|00000850| 64 24 2c 20 61 6e 64 20 | 24 64 6f 74 74 65 64 24 |d$, and |$dotted$|
|00000860| 2e 20 0a 0a 5c 69 74 65 | 6d 20 7b 33 2e 20 7d 0a |. ..\ite|m {3. }.|
|00000870| 54 68 65 20 7b 5c 73 6c | 20 6e 6f 64 65 20 77 69 |The {\sl| node wi|
|00000880| 64 74 68 7d 20 70 61 72 | 61 6d 65 74 65 72 20 28 |dth} par|ameter (|
|00000890| 64 65 66 61 75 6c 74 20 | 76 61 6c 75 65 20 31 30 |default |value 10|
|000008a0| 20 70 69 78 65 6c 73 29 | 20 64 65 66 69 6e 65 73 | pixels)| defines|
|000008b0| 20 74 68 65 20 64 69 61 | 6d 65 74 65 72 20 0a 6f | the dia|meter .o|
|000008c0| 66 20 6e 6f 64 65 73 20 | 63 72 65 61 74 65 64 20 |f nodes |created |
|000008d0| 62 79 20 74 68 65 20 64 | 72 61 77 5c 5f 6e 6f 64 |by the d|raw\_nod|
|000008e0| 65 20 61 6e 64 20 64 72 | 61 77 5c 5f 66 69 6c 6c |e and dr|aw\_fill|
|000008f0| 65 64 5c 5f 6e 6f 64 65 | 20 6f 70 65 72 61 74 69 |ed\_node| operati|
|00000900| 6f 6e 73 2e 0a 0a 5c 69 | 74 65 6d 20 7b 34 2e 20 |ons...\i|tem {4. |
|00000910| 7d 0a 54 68 65 20 7b 5c | 73 6c 20 74 65 78 74 20 |}.The {\|sl text |
|00000920| 6d 6f 64 65 7d 20 70 61 | 72 61 6d 65 74 65 72 20 |mode} pa|rameter |
|00000930| 64 65 66 69 6e 65 73 20 | 68 6f 77 20 74 65 78 74 |defines |how text|
|00000940| 20 69 73 20 69 6e 73 65 | 72 74 65 64 20 69 6e 74 | is inse|rted int|
|00000950| 6f 20 74 68 65 20 77 69 | 6e 64 6f 77 2e 0a 50 6f |o the wi|ndow..Po|
|00000960| 73 73 69 62 6c 65 20 76 | 61 6c 75 65 73 20 61 72 |ssible v|alues ar|
|00000970| 65 20 24 74 72 61 6e 73 | 70 61 72 65 6e 74 24 20 |e $trans|parent$ |
|00000980| 28 64 65 66 61 75 6c 74 | 29 20 20 61 6e 64 20 24 |(default|) and $|
|00000990| 6f 70 61 71 75 65 24 2e | 0a 0a 5c 69 74 65 6d 20 |opaque$.|..\item |
|000009a0| 7b 35 2e 20 7d 0a 54 68 | 65 20 7b 5c 73 6c 20 64 |{5. }.Th|e {\sl d|
|000009b0| 72 61 77 69 6e 67 20 6d | 6f 64 65 7d 20 70 61 72 |rawing m|ode} par|
|000009c0| 61 6d 65 74 65 72 20 64 | 65 66 69 6e 65 73 20 74 |ameter d|efines t|
|000009d0| 68 65 20 6c 6f 67 69 63 | 61 6c 20 6f 70 65 72 61 |he logic|al opera|
|000009e0| 74 69 6f 6e 20 74 68 61 | 74 20 69 73 20 75 73 65 |tion tha|t is use|
|000009f0| 64 0a 66 6f 72 20 73 65 | 74 74 69 6e 67 20 70 69 |d.for se|tting pi|
|00000a00| 78 65 6c 73 20 69 6e 20 | 61 6c 6c 20 64 72 61 77 |xels in |all draw|
|00000a10| 69 6e 67 20 6f 70 65 72 | 61 74 69 6f 6e 73 2e 20 |ing oper|ations. |
|00000a20| 50 6f 73 73 69 62 6c 65 | 20 76 61 6c 75 65 73 20 |Possible| values |
|00000a30| 61 72 65 0a 24 73 72 63 | 5c 5f 6d 6f 64 65 24 20 |are.$src|\_mode$ |
|00000a40| 28 64 65 66 61 75 6c 74 | 29 20 61 6e 64 20 24 78 |(default|) and $x|
|00000a50| 6f 72 5c 5f 6d 6f 64 65 | 24 2e 20 49 6e 20 24 73 |or\_mode|$. In $s|
|00000a60| 72 63 5c 5f 6d 6f 64 65 | 24 20 70 69 78 65 6c 73 |rc\_mode|$ pixels|
|00000a70| 20 61 72 65 20 73 65 74 | 20 74 6f 20 0a 74 68 65 | are set| to .the|
|00000a80| 20 72 65 73 70 65 63 74 | 69 76 65 20 63 6f 6c 6f | respect|ive colo|
|00000a90| 72 20 76 61 6c 75 65 2c | 20 69 6e 20 24 78 6f 72 |r value,| in $xor|
|00000aa0| 5c 5f 6d 6f 64 65 24 20 | 74 68 65 20 76 61 6c 75 |\_mode$ |the valu|
|00000ab0| 65 20 69 73 20 62 69 74 | 77 69 73 65 20 61 64 64 |e is bit|wise add|
|00000ac0| 65 64 20 74 6f 20 74 68 | 65 20 0a 63 75 72 72 65 |ed to th|e .curre|
|00000ad0| 6e 74 20 70 69 78 65 6c | 20 76 61 6c 75 65 2e 0a |nt pixel| value..|
|00000ae0| 0a 5c 69 74 65 6d 20 7b | 36 2e 20 7d 0a 54 68 65 |.\item {|6. }.The|
|00000af0| 20 7b 5c 73 6c 20 72 65 | 64 72 61 77 20 66 75 6e | {\sl re|draw fun|
|00000b00| 63 74 69 6f 6e 7d 20 70 | 61 72 61 6d 65 74 65 72 |ction} p|arameter|
|00000b10| 20 69 73 20 75 73 65 64 | 20 74 6f 20 72 65 64 72 | is used| to redr|
|00000b20| 61 77 20 74 68 65 20 65 | 6e 74 69 72 65 20 77 69 |aw the e|ntire wi|
|00000b30| 6e 64 6f 77 2c 20 0a 77 | 68 65 6e 65 76 65 72 20 |ndow, .w|henever |
|00000b40| 61 20 72 65 64 72 61 77 | 69 6e 67 20 69 73 20 6e |a redraw|ing is n|
|00000b50| 65 63 65 73 73 61 72 79 | 2c 20 65 2e 67 2e 2c 20 |ecessary|, e.g., |
|00000b60| 69 66 20 74 68 65 20 77 | 69 6e 64 6f 77 20 73 68 |if the w|indow sh|
|00000b70| 61 70 65 20 6f 6e 20 74 | 68 65 20 73 63 72 65 65 |ape on t|he scree|
|00000b80| 6e 20 0a 68 61 73 20 20 | 62 65 65 6e 20 63 68 61 |n .has |been cha|
|00000b90| 6e 67 65 64 2e 20 49 74 | 73 20 74 79 70 65 20 69 |nged. It|s type i|
|00000ba0| 73 20 70 6f 69 6e 74 65 | 72 20 74 6f 20 61 20 76 |s pointe|r to a v|
|00000bb0| 6f 69 64 2d 66 75 6e 63 | 74 69 6f 6e 20 74 61 6b |oid-func|tion tak|
|00000bc0| 69 6e 67 20 6e 6f 20 61 | 72 67 75 6d 65 6e 74 73 |ing no a|rguments|
|00000bd0| 2c 0a 69 2e 65 2e 2c 20 | 76 6f 69 64 20 28 2a 46 |,.i.e., |void (*F|
|00000be0| 29 28 29 3b 0a 5c 65 6e | 64 69 74 65 6d 0a 0a 5c |)();.\en|ditem..\|
|00000bf0| 64 65 66 5c 76 61 72 20 | 7b 24 57 24 7d 0a 5c 64 |def\var |{$W$}.\d|
|00000c00| 65 66 5c 6e 61 6d 65 20 | 7b 24 77 69 6e 64 6f 77 |ef\name |{$window|
|00000c10| 24 7d 0a 5c 64 65 66 5c | 74 79 70 65 20 7b 24 77 |$}.\def\|type {$w|
|00000c20| 69 6e 64 6f 77 24 7d 0a | 0a 5c 62 69 67 73 6b 69 |indow$}.|.\bigski|
|00000c30| 70 0a 7b 5c 62 66 20 32 | 2e 20 43 72 65 61 74 69 |p.{\bf 2|. Creati|
|00000c40| 6f 6e 7d 0a 0a 61 29 20 | 5c 63 72 65 61 74 65 20 |on}..a) |\create |
|00000c50| 57 20 28 69 6e 74 5c 20 | 78 70 69 78 2c 5c 20 69 |W (int\ |xpix,\ i|
|00000c60| 6e 74 5c 20 79 70 69 78 | 2c 5c 20 69 6e 74 5c 20 |nt\ ypix|,\ int\ |
|00000c70| 78 70 6f 73 2c 5c 20 69 | 6e 74 5c 20 79 70 6f 73 |xpos,\ i|nt\ ypos|
|00000c80| 29 0a 0a 62 29 20 5c 63 | 72 65 61 74 65 20 57 20 |)..b) \c|reate W |
|00000c90| 28 69 6e 74 5c 20 78 70 | 69 78 2c 5c 20 69 6e 74 |(int\ xp|ix,\ int|
|00000ca0| 5c 20 79 70 69 78 29 0a | 0a 63 29 20 5c 63 72 65 |\ ypix).|.c) \cre|
|00000cb0| 61 74 65 20 57 20 7b 7d | 0a 0a 56 61 72 69 61 6e |ate W {}|..Varian|
|00000cc0| 74 20 61 29 20 63 72 65 | 61 74 65 73 20 61 20 77 |t a) cre|ates a w|
|00000cd0| 69 6e 64 6f 77 20 24 57 | 24 20 6f 66 20 70 68 79 |indow $W|$ of phy|
|00000ce0| 73 69 63 61 6c 20 73 69 | 7a 65 20 24 78 70 69 78 |sical si|ze $xpix|
|00000cf0| 20 5c 74 69 6d 65 73 20 | 79 70 69 78 24 20 70 69 | \times |ypix$ pi|
|00000d00| 78 65 6c 73 20 0a 77 69 | 74 68 20 69 74 73 20 75 |xels .wi|th its u|
|00000d10| 70 70 65 72 20 6c 65 66 | 74 20 63 6f 72 6e 65 72 |pper lef|t corner|
|00000d20| 20 61 74 20 70 6f 73 69 | 74 69 6f 6e 20 28 24 78 | at posi|tion ($x|
|00000d30| 70 6f 73 2c 79 70 6f 73 | 24 29 20 6f 6e 20 74 68 |pos,ypos|$) on th|
|00000d40| 65 20 73 63 72 65 65 6e | 2c 0a 76 61 72 69 61 6e |e screen|,.varian|
|00000d50| 74 20 62 29 20 70 6c 61 | 63 65 73 20 24 57 24 20 |t b) pla|ces $W$ |
|00000d60| 69 6e 74 6f 20 74 68 65 | 20 75 70 70 65 72 20 72 |into the| upper r|
|00000d70| 69 67 68 74 20 63 6f 72 | 6e 65 72 20 6f 66 20 74 |ight cor|ner of t|
|00000d80| 68 65 20 73 63 72 65 65 | 6e 2c 20 61 6e 64 0a 76 |he scree|n, and.v|
|00000d90| 61 72 69 61 6e 74 20 63 | 29 20 63 72 65 61 74 65 |ariant c|) create|
|00000da0| 73 20 61 20 24 38 35 30 | 20 5c 74 69 6d 65 73 20 |s a $850| \times |
|00000db0| 38 35 30 24 20 70 69 78 | 65 6c 20 77 69 6e 64 6f |850$ pix|el windo|
|00000dc0| 77 20 70 6f 73 69 74 69 | 6f 6e 65 64 20 69 6e 74 |w positi|oned int|
|00000dd0| 6f 20 74 68 65 0a 75 70 | 70 65 72 20 72 69 67 68 |o the.up|per righ|
|00000de0| 74 20 63 6f 72 6e 65 72 | 2e 0a 0a 41 6c 6c 20 74 |t corner|...All t|
|00000df0| 68 72 65 65 20 76 61 72 | 69 61 6e 74 73 20 69 6e |hree var|iants in|
|00000e00| 69 74 69 61 6c 69 7a 65 | 20 74 68 65 20 63 6f 6f |itialize| the coo|
|00000e10| 72 64 69 6e 61 74 65 73 | 20 6f 66 20 24 57 24 20 |rdinates| of $W$ |
|00000e20| 74 6f 20 24 78 30 20 3d | 20 30 24 2c 0a 24 78 31 |to $x0 =| 0$,.$x1|
|00000e30| 20 3d 20 31 30 30 24 20 | 61 6e 64 20 24 79 30 20 | = 100$ |and $y0 |
|00000e40| 3d 20 30 24 2e 20 54 68 | 65 20 24 69 6e 69 74 24 |= 0$. Th|e $init$|
|00000e50| 20 6f 70 65 72 61 74 69 | 6f 6e 20 28 73 65 65 20 | operati|on (see |
|00000e60| 20 62 65 6c 6f 77 29 20 | 63 61 6e 20 6c 61 74 65 | below) |can late|
|00000e70| 72 20 0a 62 65 20 75 73 | 65 64 20 74 6f 20 63 68 |r .be us|ed to ch|
|00000e80| 61 6e 67 65 20 74 68 65 | 20 77 69 6e 64 6f 77 20 |ange the| window |
|00000e90| 63 6f 6f 72 64 69 6e 61 | 74 65 73 20 61 6e 64 20 |coordina|tes and |
|00000ea0| 73 63 61 6c 69 6e 67 2e | 0a 0a 5c 63 6c 65 61 72 |scaling.|..\clear|
|00000eb0| 74 61 62 73 0a 5c 2b 26 | 5c 68 73 6b 69 70 20 32 |tabs.\+&|\hskip 2|
|00000ec0| 2e 32 74 72 75 65 63 6d | 20 26 5c 68 73 6b 69 70 |.2truecm| &\hskip|
|00000ed0| 20 34 74 72 75 65 63 6d | 20 26 5c 63 72 0a 7b 5c | 4truecm| &\cr.{\|
|00000ee0| 62 66 20 33 2e 20 4f 70 | 65 72 61 74 69 6f 6e 73 |bf 3. Op|erations|
|00000ef0| 7d 0a 0a 5c 62 69 67 73 | 6b 69 70 0a 7b 5c 62 66 |}..\bigs|kip.{\bf|
|00000f00| 20 33 2e 31 20 49 6e 69 | 74 69 61 6c 69 7a 61 74 | 3.1 Ini|tializat|
|00000f10| 69 6f 6e 7d 0a 5c 6d 65 | 64 73 6b 69 70 0a 5c 2b |ion}.\me|dskip.\+|
|00000f20| 5c 6f 70 20 76 6f 69 64 | 20 69 6e 69 74 20 7b 64 |\op void| init {d|
|00000f30| 6f 75 62 6c 65 5c 20 78 | 5f 30 2c 5c 20 64 6f 75 |ouble\ x|_0,\ dou|
|00000f40| 62 6c 65 5c 20 78 5f 31 | 2c 5c 20 64 6f 75 62 6c |ble\ x_1|,\ doubl|
|00000f50| 65 5c 20 79 5f 30 7d 20 | 7b 7d 0a 5c 2b 5c 6e 6f |e\ y_0} |{}.\+\no|
|00000f60| 70 20 20 20 20 20 20 20 | 20 20 20 7b 73 65 74 73 |p | {sets|
|00000f70| 20 74 68 65 20 63 6f 6f | 72 64 69 6e 61 74 65 73 | the coo|rdinates|
|00000f80| 20 6f 66 20 24 57 24 20 | 74 6f 20 24 78 5f 30 24 | of $W$ |to $x_0$|
|00000f90| 2c 24 78 5f 31 24 2c 20 | 61 6e 64 20 24 79 5f 30 |,$x_1$, |and $y_0|
|00000fa0| 24 7d 0a 5c 6d 65 64 73 | 6b 69 70 0a 5c 2b 5c 6f |$}.\meds|kip.\+\o|
|00000fb0| 70 20 76 6f 69 64 20 73 | 65 74 5c 5f 67 72 69 64 |p void s|et\_grid|
|00000fc0| 5c 5f 6d 6f 64 65 20 7b | 69 6e 74 5c 20 64 7d 20 |\_mode {|int\ d} |
|00000fd0| 20 7b 7d 0a 5c 2b 5c 6e | 6f 70 20 20 20 20 20 20 | {}.\+\n|op |
|00000fe0| 20 20 20 20 7b 41 64 64 | 73 20 61 20 72 65 63 74 | {Add|s a rect|
|00000ff0| 61 6e 67 75 6c 61 72 20 | 67 72 69 64 20 77 69 74 |angular |grid wit|
|00001000| 68 20 69 6e 74 65 67 65 | 72 20 63 6f 6f 72 64 69 |h intege|r coordi|
|00001010| 6e 61 74 65 73 20 61 6e | 64 20 7d 0a 5c 2b 5c 6e |nates an|d }.\+\n|
|00001020| 6f 70 20 20 20 20 20 20 | 20 20 20 20 7b 67 72 69 |op | {gri|
|00001030| 64 20 64 69 73 74 61 6e | 63 65 20 24 64 24 20 74 |d distan|ce $d$ t|
|00001040| 6f 20 24 57 24 2c 20 69 | 66 20 24 64 20 3e 20 30 |o $W$, i|f $d > 0|
|00001050| 24 2e 20 52 65 6d 6f 76 | 65 73 20 67 72 69 64 20 |$. Remov|es grid |
|00001060| 66 72 6f 6d 7d 20 0a 5c | 2b 5c 6e 6f 70 20 20 20 |from} .\|+\nop |
|00001070| 20 20 20 20 20 20 20 7b | 24 57 24 2c 20 69 66 20 | {|$W$, if |
|00001080| 24 64 5c 6c 65 20 30 24 | 2e 7d 0a 5c 6d 65 64 73 |$d\le 0$|.}.\meds|
|00001090| 6b 69 70 0a 5c 2b 5c 6f | 70 20 76 6f 69 64 20 69 |kip.\+\o|p void i|
|000010a0| 6e 69 74 20 7b 64 6f 75 | 62 6c 65 5c 20 78 5f 30 |nit {dou|ble\ x_0|
|000010b0| 2c 5c 20 64 6f 75 62 6c | 65 5c 20 78 5f 31 2c 5c |,\ doubl|e\ x_1,\|
|000010c0| 20 64 6f 75 62 6c 65 5c | 20 79 5f 30 2c 5c 20 69 | double\| y_0,\ i|
|000010d0| 6e 74 5c 20 64 7d 20 7b | 7d 0a 5c 2b 5c 6e 6f 70 |nt\ d} {|}.\+\nop|
|000010e0| 20 20 20 20 20 20 20 20 | 20 20 7b 6c 69 6b 65 20 | | {like |
|000010f0| 69 6e 69 74 28 24 78 5f | 30 2c 78 5f 31 2c 79 5f |init($x_|0,x_1,y_|
|00001100| 30 24 29 20 66 6f 6c 6c | 6f 77 65 64 20 62 79 20 |0$) foll|owed by |
|00001110| 73 65 74 5c 5f 67 72 69 | 64 28 24 64 24 29 7d 0a |set\_gri|d($d$)}.|
|00001120| 5c 6d 65 64 73 6b 69 70 | 0a 5c 2b 5c 6f 70 20 76 |\medskip|.\+\op v|
|00001130| 6f 69 64 20 63 6c 65 61 | 72 20 7b 7d 20 20 20 7b |oid clea|r {} {|
|00001140| 24 57 24 20 69 73 20 65 | 72 61 73 65 64 2e 7d 0a |$W$ is e|rased.}.|
|00001150| 5c 6d 65 64 73 6b 69 70 | 0a 0a 5c 76 66 69 6c 6c |\medskip|..\vfill|
|00001160| 5c 65 6a 65 63 74 0a 0a | 5c 62 69 67 73 6b 69 70 |\eject..|\bigskip|
|00001170| 0a 7b 5c 62 66 20 33 2e | 32 20 53 65 74 74 69 6e |.{\bf 3.|2 Settin|
|00001180| 67 20 70 61 72 61 6d 65 | 74 65 72 73 7d 0a 5c 6d |g parame|ters}.\m|
|00001190| 65 64 73 6b 69 70 0a 5c | 2b 5c 6f 70 20 69 6e 74 |edskip.\|+\op int|
|000011a0| 20 73 65 74 5c 5f 6c 69 | 6e 65 5c 5f 77 69 64 74 | set\_li|ne\_widt|
|000011b0| 68 20 7b 69 6e 74 5c 20 | 70 69 78 7d 20 20 7b 7d |h {int\ |pix} {}|
|000011c0| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 20 20 20 20 20 |.\+\nop | |
|000011d0| 7b 53 65 74 73 20 74 68 | 65 20 6c 69 6e 65 20 77 |{Sets th|e line w|
|000011e0| 69 64 74 68 20 70 61 72 | 61 6d 65 74 65 72 20 74 |idth par|ameter t|
|000011f0| 6f 20 24 70 69 78 24 20 | 70 69 78 65 6c 73 20 61 |o $pix$ |pixels a|
|00001200| 6e 64 20 7d 0a 5c 2b 5c | 6e 6f 70 20 20 20 20 20 |nd }.\+\|nop |
|00001210| 20 20 20 20 7b 72 65 74 | 75 72 6e 73 20 69 74 73 | {ret|urns its|
|00001220| 20 70 72 65 76 69 6f 75 | 73 20 76 61 6c 75 65 2e | previou|s value.|
|00001230| 7d 0a 5c 6d 65 64 73 6b | 69 70 0a 5c 2b 5c 6f 70 |}.\medsk|ip.\+\op|
|00001240| 20 6c 69 6e 65 5c 5f 73 | 74 79 6c 65 20 73 65 74 | line\_s|tyle set|
|00001250| 5c 5f 6c 69 6e 65 5c 5f | 73 74 79 6c 65 20 7b 6c |\_line\_|style {l|
|00001260| 69 6e 65 73 74 79 6c 65 | 5c 20 73 7d 20 20 7b 7d |inestyle|\ s} {}|
|00001270| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 20 20 20 20 20 |.\+\nop | |
|00001280| 7b 53 65 74 73 20 74 68 | 65 20 6c 69 6e 65 20 73 |{Sets th|e line s|
|00001290| 74 79 6c 65 20 70 61 72 | 61 6d 65 74 65 72 20 74 |tyle par|ameter t|
|000012a0| 6f 20 24 73 24 20 61 6e | 64 20 72 65 74 75 72 6e |o $s$ an|d return|
|000012b0| 73 20 69 74 73 20 7d 0a | 5c 2b 5c 6e 6f 70 20 20 |s its }.|\+\nop |
|000012c0| 20 20 20 20 20 20 20 7b | 70 72 65 76 69 6f 75 73 | {|previous|
|000012d0| 20 76 61 6c 75 65 2e 7d | 0a 5c 6d 65 64 73 6b 69 | value.}|.\medski|
|000012e0| 70 0a 5c 2b 5c 6f 70 20 | 69 6e 74 20 73 65 74 5c |p.\+\op |int set\|
|000012f0| 5f 6e 6f 64 65 5c 5f 77 | 69 64 74 68 20 7b 69 6e |_node\_w|idth {in|
|00001300| 74 5c 20 70 69 78 7d 20 | 20 20 7b 7d 0a 5c 2b 5c |t\ pix} | {}.\+\|
|00001310| 6e 6f 70 20 20 20 20 20 | 20 20 20 20 7b 53 65 74 |nop | {Set|
|00001320| 73 20 74 68 65 20 6e 6f | 64 65 20 77 69 64 74 68 |s the no|de width|
|00001330| 20 70 61 72 61 6d 65 74 | 65 72 20 74 6f 20 24 70 | paramet|er to $p|
|00001340| 69 78 24 20 70 69 78 65 | 6c 73 20 61 6e 64 20 7d |ix$ pixe|ls and }|
|00001350| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 20 20 20 20 20 |.\+\nop | |
|00001360| 7b 72 65 74 75 72 6e 73 | 20 69 74 73 20 70 72 65 |{returns| its pre|
|00001370| 76 69 6f 75 73 20 76 61 | 6c 75 65 2e 7d 0a 5c 6d |vious va|lue.}.\m|
|00001380| 65 64 73 6b 69 70 0a 5c | 2b 5c 6f 70 20 74 65 78 |edskip.\|+\op tex|
|00001390| 74 5c 5f 6d 6f 64 65 20 | 73 65 74 5c 5f 74 65 78 |t\_mode |set\_tex|
|000013a0| 74 5c 5f 6d 6f 64 65 20 | 7b 74 65 78 74 5c 5f 6d |t\_mode |{text\_m|
|000013b0| 6f 64 65 5c 20 6d 7d 20 | 20 20 7b 7d 0a 5c 2b 5c |ode\ m} | {}.\+\|
|000013c0| 6e 6f 70 20 20 20 20 20 | 20 20 20 20 7b 53 65 74 |nop | {Set|
|000013d0| 73 20 74 68 65 20 74 65 | 78 74 20 6d 6f 64 65 20 |s the te|xt mode |
|000013e0| 70 61 72 61 6d 65 74 65 | 72 20 74 6f 20 24 6d 24 |paramete|r to $m$|
|000013f0| 20 61 6e 64 20 72 65 74 | 75 72 6e 73 7d 0a 5c 2b | and ret|urns}.\+|
|00001400| 5c 6e 6f 70 20 20 20 20 | 20 20 20 20 20 7b 69 74 |\nop | {it|
|00001410| 73 20 70 72 65 76 69 6f | 75 73 20 76 61 6c 75 65 |s previo|us value|
|00001420| 2e 7d 0a 5c 6d 65 64 73 | 6b 69 70 0a 5c 2b 5c 6f |.}.\meds|kip.\+\o|
|00001430| 70 20 64 72 61 77 69 6e | 67 5c 5f 6d 6f 64 65 20 |p drawin|g\_mode |
|00001440| 73 65 74 5c 5f 6d 6f 64 | 65 20 7b 64 72 61 77 69 |set\_mod|e {drawi|
|00001450| 6e 67 5c 5f 6d 6f 64 65 | 5c 20 6d 7d 20 20 20 7b |ng\_mode|\ m} {|
|00001460| 7d 0a 5c 2b 5c 6e 6f 70 | 20 20 20 20 20 20 20 20 |}.\+\nop| |
|00001470| 20 7b 53 65 74 73 20 74 | 68 65 20 64 72 61 77 69 | {Sets t|he drawi|
|00001480| 6e 67 20 6d 6f 64 65 20 | 70 61 72 61 6d 65 74 65 |ng mode |paramete|
|00001490| 72 20 74 6f 20 24 6d 24 | 20 61 6e 64 20 72 65 74 |r to $m$| and ret|
|000014a0| 75 72 6e 73 7d 0a 5c 2b | 5c 6e 6f 70 20 20 20 20 |urns}.\+|\nop |
|000014b0| 20 20 20 20 20 7b 69 74 | 73 20 70 72 65 76 69 6f | {it|s previo|
|000014c0| 75 73 20 76 61 6c 75 65 | 2e 7d 0a 5c 6d 65 64 73 |us value|.}.\meds|
|000014d0| 6b 69 70 0a 5c 2b 5c 6f | 70 20 76 6f 69 64 20 73 |kip.\+\o|p void s|
|000014e0| 65 74 5c 5f 72 65 64 72 | 61 77 20 7b 76 6f 69 64 |et\_redr|aw {void|
|000014f0| 5c 20 28 2a 46 29 28 29 | 7d 20 7b 7d 20 0a 5c 2b |\ (*F)()|} {} .\+|
|00001500| 5c 6e 6f 70 20 20 20 20 | 20 20 20 20 20 20 7b 53 |\nop | {S|
|00001510| 65 74 73 20 74 68 65 20 | 72 65 64 72 61 77 20 66 |ets the |redraw f|
|00001520| 75 6e 63 74 69 6f 6e 20 | 70 61 72 61 6d 65 74 65 |unction |paramete|
|00001530| 72 20 74 6f 20 24 46 24 | 2e 7d 20 0a 0a 5c 62 69 |r to $F$|.} ..\bi|
|00001540| 67 73 6b 69 70 0a 7b 5c | 62 66 20 33 2e 33 20 52 |gskip.{\|bf 3.3 R|
|00001550| 65 61 64 69 6e 67 20 70 | 61 72 61 6d 65 74 65 72 |eading p|arameter|
|00001560| 73 20 61 6e 64 20 77 69 | 6e 64 6f 77 20 63 6f 6f |s and wi|ndow coo|
|00001570| 72 64 69 6e 61 74 65 73 | 7d 0a 5c 62 69 67 73 6b |rdinates|}.\bigsk|
|00001580| 69 70 0a 5c 2b 5c 6f 70 | 20 69 6e 74 20 20 20 20 |ip.\+\op| int |
|00001590| 20 20 20 20 20 67 65 74 | 5c 5f 6c 69 6e 65 5c 5f | get|\_line\_|
|000015a0| 77 69 64 74 68 20 7b 7d | 20 20 20 20 20 20 0a 20 |width {}| . |
|000015b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000015c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000015d0| 20 20 20 20 20 20 20 20 | 20 20 7b 72 65 74 75 72 | | {retur|
|000015e0| 6e 73 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 6c |ns the c|urrent l|
|000015f0| 69 6e 65 20 77 69 64 74 | 68 2e 7d 20 0a 5c 6d 65 |ine widt|h.} .\me|
|00001600| 64 73 6b 69 70 0a 5c 2b | 5c 6f 70 20 6c 69 6e 65 |dskip.\+|\op line|
|00001610| 5c 5f 73 74 79 6c 65 20 | 67 65 74 5c 5f 6c 69 6e |\_style |get\_lin|
|00001620| 65 5c 5f 73 74 79 6c 65 | 20 7b 7d 20 20 20 20 20 |e\_style| {} |
|00001630| 20 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | . | |
|00001640| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001650| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 7b 72 65 | | {re|
|00001660| 74 75 72 6e 73 20 74 68 | 65 20 63 75 72 72 65 6e |turns th|e curren|
|00001670| 74 20 6c 69 6e 65 20 73 | 74 79 6c 65 2e 7d 20 0a |t line s|tyle.} .|
|00001680| 5c 6d 65 64 73 6b 69 70 | 0a 5c 2b 5c 6f 70 20 69 |\medskip|.\+\op i|
|00001690| 6e 74 20 20 20 20 20 20 | 20 20 20 67 65 74 5c 5f |nt | get\_|
|000016a0| 6e 6f 64 65 5c 5f 77 69 | 64 74 68 20 7b 7d 20 20 |node\_wi|dth {} |
|000016b0| 20 20 20 20 0a 20 20 20 | 20 20 20 20 20 20 20 20 | . | |
|000016c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000016d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000016e0| 7b 72 65 74 75 72 6e 73 | 20 74 68 65 20 63 75 72 |{returns| the cur|
|000016f0| 72 65 6e 74 20 6e 6f 64 | 65 20 77 69 64 74 68 2e |rent nod|e width.|
|00001700| 7d 20 0a 5c 6d 65 64 73 | 6b 69 70 0a 5c 2b 5c 6f |} .\meds|kip.\+\o|
|00001710| 70 20 74 65 78 74 5c 5f | 6d 6f 64 65 20 20 67 65 |p text\_|mode ge|
|00001720| 74 5c 5f 74 65 78 74 5c | 5f 6d 6f 64 65 20 7b 7d |t\_text\|_mode {}|
|00001730| 20 20 20 20 20 20 20 0a | 20 20 20 20 20 20 20 20 | .| |
|00001740| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001750| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001760| 20 20 20 7b 72 65 74 75 | 72 6e 73 20 74 68 65 20 | {retu|rns the |
|00001770| 63 75 72 72 65 6e 74 20 | 74 65 78 74 20 6d 6f 64 |current |text mod|
|00001780| 65 2e 7d 20 0a 5c 6d 65 | 64 73 6b 69 70 0a 5c 2b |e.} .\me|dskip.\+|
|00001790| 5c 6f 70 20 64 72 61 77 | 69 6e 67 5c 5f 6d 6f 64 |\op draw|ing\_mod|
|000017a0| 65 20 20 67 65 74 5c 5f | 6d 6f 64 65 20 7b 7d 20 |e get\_|mode {} |
|000017b0| 7b 7d 0a 5c 2b 5c 6e 6f | 70 20 20 20 20 20 20 20 |{}.\+\no|p |
|000017c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000017d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 7b 72 | | {r|
|000017e0| 65 74 75 72 6e 73 20 74 | 68 65 20 63 75 72 72 65 |eturns t|he curre|
|000017f0| 6e 74 20 64 72 61 77 69 | 6e 67 20 6d 6f 64 65 2e |nt drawi|ng mode.|
|00001800| 7d 20 0a 5c 6d 65 64 73 | 6b 69 70 0a 5c 2b 5c 6f |} .\meds|kip.\+\o|
|00001810| 70 20 64 6f 75 62 6c 65 | 20 20 20 20 20 20 20 20 |p double| |
|00001820| 78 6d 69 6e 20 7b 7d 20 | 20 0a 20 20 20 20 20 20 |xmin {} | . |
|00001830| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001840| 20 20 20 20 20 7b 72 65 | 74 75 72 6e 73 20 24 78 | {re|turns $x|
|00001850| 5f 30 24 2c 20 74 68 65 | 20 6d 69 6e 69 6d 61 6c |_0$, the| minimal|
|00001860| 20 78 2d 63 6f 6f 72 64 | 69 6e 61 74 65 20 6f 66 | x-coord|inate of|
|00001870| 20 24 57 24 2e 7d 20 0a | 5c 6d 65 64 73 6b 69 70 | $W$.} .|\medskip|
|00001880| 0a 5c 2b 5c 6f 70 20 64 | 6f 75 62 6c 65 20 20 20 |.\+\op d|ouble |
|00001890| 20 20 20 20 20 79 6d 69 | 6e 20 7b 7d 20 20 0a 20 | ymi|n {} . |
|000018a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000018b0| 20 20 20 20 20 20 20 20 | 20 20 7b 72 65 74 75 72 | | {retur|
|000018c0| 6e 73 20 24 79 5f 30 24 | 2c 20 74 68 65 20 6d 69 |ns $y_0$|, the mi|
|000018d0| 6e 69 6d 61 6c 20 79 2d | 63 6f 6f 72 64 69 6e 61 |nimal y-|coordina|
|000018e0| 74 65 20 6f 66 20 24 57 | 24 2e 7d 20 0a 5c 6d 65 |te of $W|$.} .\me|
|000018f0| 64 73 6b 69 70 0a 5c 2b | 5c 6f 70 20 64 6f 75 62 |dskip.\+|\op doub|
|00001900| 6c 65 20 20 20 20 20 20 | 20 20 78 6d 61 78 20 7b |le | xmax {|
|00001910| 7d 20 20 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |} . | |
|00001920| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 7b | | {|
|00001930| 72 65 74 75 72 6e 73 20 | 24 78 5f 31 24 2c 20 74 |returns |$x_1$, t|
|00001940| 68 65 20 6d 61 78 69 6d | 61 6c 20 78 2d 63 6f 6f |he maxim|al x-coo|
|00001950| 72 64 69 6e 61 74 65 20 | 6f 66 20 24 57 24 2e 7d |rdinate |of $W$.}|
|00001960| 20 0a 5c 6d 65 64 73 6b | 69 70 0a 5c 2b 5c 6f 70 | .\medsk|ip.\+\op|
|00001970| 20 64 6f 75 62 6c 65 20 | 20 20 20 20 20 20 20 79 | double | y|
|00001980| 6d 61 78 20 7b 7d 20 20 | 0a 20 20 20 20 20 20 20 |max {} |. |
|00001990| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000019a0| 20 20 20 20 7b 72 65 74 | 75 72 6e 73 20 24 79 5f | {ret|urns $y_|
|000019b0| 31 24 2c 20 74 68 65 20 | 6d 61 78 69 6d 61 6c 20 |1$, the |maximal |
|000019c0| 79 2d 63 6f 6f 72 64 69 | 6e 61 74 65 20 6f 66 20 |y-coordi|nate of |
|000019d0| 24 57 24 2e 7d 20 0a 5c | 6d 65 64 73 6b 69 70 0a |$W$.} .\|medskip.|
|000019e0| 5c 2b 5c 6f 70 20 64 6f | 75 62 6c 65 20 20 20 20 |\+\op do|uble |
|000019f0| 20 20 20 20 73 63 61 6c | 65 20 7b 7d 20 0a 20 20 | scal|e {} . |
|00001a00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001a10| 20 20 20 20 20 20 20 20 | 20 7b 72 65 74 75 72 6e | | {return|
|00001a20| 73 20 74 68 65 20 6e 75 | 6d 62 65 72 20 6f 66 20 |s the nu|mber of |
|00001a30| 70 69 78 65 6c 73 20 6f | 66 20 61 20 75 6e 69 74 |pixels o|f a unit|
|00001a40| 20 6c 65 6e 67 74 68 7d | 0a 5c 2b 5c 6e 6f 70 20 | length}|.\+\nop |
|00001a50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001a60| 20 20 20 20 7b 6c 69 6e | 65 20 73 65 67 6d 65 6e | {lin|e segmen|
|00001a70| 74 2e 7d 0a 5c 6d 65 64 | 73 6b 69 70 0a 0a 5c 76 |t.}.\med|skip..\v|
|00001a80| 66 69 6c 6c 5c 65 6a 65 | 63 74 0a 0a 5c 62 69 67 |fill\eje|ct..\big|
|00001a90| 73 6b 69 70 0a 7b 5c 62 | 66 20 33 2e 34 20 44 72 |skip.{\b|f 3.4 Dr|
|00001aa0| 61 77 69 6e 67 20 70 6f | 69 6e 74 73 7d 0a 5c 62 |awing po|ints}.\b|
|00001ab0| 69 67 73 6b 69 70 0a 5c | 2b 5c 6f 70 20 76 6f 69 |igskip.\|+\op voi|
|00001ac0| 64 20 64 72 61 77 5c 5f | 70 6f 69 6e 74 20 7b 64 |d draw\_|point {d|
|00001ad0| 6f 75 62 6c 65 5c 20 78 | 2c 5c 20 64 6f 75 62 6c |ouble\ x|,\ doubl|
|00001ae0| 65 5c 20 79 2c 5c 20 63 | 6f 6c 6f 72 5c 20 63 3d |e\ y,\ c|olor\ c=|
|00001af0| 62 6c 61 63 6b 7d 20 7b | 7d 0a 5c 2b 5c 6e 6f 70 |black} {|}.\+\nop|
|00001b00| 20 20 20 20 7b 64 72 61 | 77 73 20 74 68 65 20 70 | {dra|ws the p|
|00001b10| 6f 69 6e 74 20 24 28 78 | 2c 79 29 24 20 61 73 20 |oint $(x|,y)$ as |
|00001b20| 61 20 63 72 6f 73 73 20 | 6f 66 20 61 20 76 65 72 |a cross |of a ver|
|00001b30| 74 69 63 61 6c 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 |tical}.\|+\nop |
|00001b40| 20 7b 61 6e 64 20 61 20 | 68 6f 72 69 7a 6f 6e 74 | {and a |horizont|
|00001b50| 61 6c 20 73 65 67 6d 65 | 6e 74 20 69 6e 74 65 72 |al segme|nt inter|
|00001b60| 73 65 63 74 69 6e 67 20 | 61 74 20 24 28 78 2c 79 |secting |at $(x,y|
|00001b70| 29 24 2e 7d 0a 5c 6d 65 | 64 73 6b 69 70 0a 5c 2b |)$.}.\me|dskip.\+|
|00001b80| 5c 6f 70 20 76 6f 69 64 | 20 64 72 61 77 5c 5f 70 |\op void| draw\_p|
|00001b90| 6f 69 6e 74 20 7b 70 6f | 69 6e 74 5c 20 70 2c 5c |oint {po|int\ p,\|
|00001ba0| 20 63 3d 62 6c 61 63 6b | 7d 20 20 7b 7d 0a 5c 2b | c=black|} {}.\+|
|00001bb0| 5c 6e 6f 70 20 20 20 20 | 7b 64 72 61 77 73 20 70 |\nop |{draws p|
|00001bc0| 6f 69 6e 74 20 28 24 70 | 24 2e 78 63 6f 6f 72 64 |oint ($p|$.xcoord|
|00001bd0| 28 29 2c 24 70 24 2e 79 | 63 6f 6f 72 64 28 29 29 |(),$p$.y|coord())|
|00001be0| 2e 7d 0a 0a 5c 62 69 67 | 73 6b 69 70 0a 7b 5c 62 |.}..\big|skip.{\b|
|00001bf0| 66 20 33 2e 35 20 44 72 | 61 77 69 6e 67 20 6c 69 |f 3.5 Dr|awing li|
|00001c00| 6e 65 20 73 65 67 6d 65 | 6e 74 73 7d 0a 5c 62 69 |ne segme|nts}.\bi|
|00001c10| 67 73 6b 69 70 0a 5c 2b | 5c 6f 70 20 76 6f 69 64 |gskip.\+|\op void|
|00001c20| 20 64 72 61 77 5c 5f 73 | 65 67 6d 65 6e 74 20 7b | draw\_s|egment {|
|00001c30| 64 6f 75 62 6c 65 5c 20 | 78 5f 31 2c 5c 20 64 6f |double\ |x_1,\ do|
|00001c40| 75 62 6c 65 5c 20 79 5f | 31 2c 5c 20 64 6f 75 62 |uble\ y_|1,\ doub|
|00001c50| 6c 65 5c 20 78 5f 32 2c | 5c 20 64 6f 75 62 6c 65 |le\ x_2,|\ double|
|00001c60| 5c 20 79 5f 32 2c 5c 20 | 63 6f 6c 6f 72 5c 20 63 |\ y_2,\ |color\ c|
|00001c70| 3d 62 6c 61 63 6b 7d 20 | 7b 7d 0a 5c 2b 5c 6e 6f |=black} |{}.\+\no|
|00001c80| 70 20 20 20 20 7b 64 72 | 61 77 73 20 61 20 6c 69 |p {dr|aws a li|
|00001c90| 6e 65 20 73 65 67 6d 65 | 6e 74 20 66 72 6f 6d 20 |ne segme|nt from |
|00001ca0| 24 28 78 5f 31 2c 79 5f | 31 29 24 20 74 6f 20 24 |$(x_1,y_|1)$ to $|
|00001cb0| 28 78 5f 32 2c 79 5f 32 | 29 24 2e 7d 0a 5c 6d 65 |(x_2,y_2|)$.}.\me|
|00001cc0| 64 73 6b 69 70 0a 5c 2b | 5c 6f 70 20 76 6f 69 64 |dskip.\+|\op void|
|00001cd0| 20 64 72 61 77 5c 5f 73 | 65 67 6d 65 6e 74 20 7b | draw\_s|egment {|
|00001ce0| 70 6f 69 6e 74 5c 20 70 | 2c 5c 20 70 6f 69 6e 74 |point\ p|,\ point|
|00001cf0| 5c 20 71 2c 5c 20 63 6f | 6c 6f 72 5c 20 63 3d 62 |\ q,\ co|lor\ c=b|
|00001d00| 6c 61 63 6b 7d 20 7b 7d | 0a 5c 2b 5c 6e 6f 70 20 |lack} {}|.\+\nop |
|00001d10| 20 20 20 7b 64 72 61 77 | 73 20 61 20 6c 69 6e 65 | {draw|s a line|
|00001d20| 20 73 65 67 6d 65 6e 74 | 20 66 72 6f 6d 20 70 6f | segment| from po|
|00001d30| 69 6e 74 20 24 70 24 20 | 74 6f 20 70 6f 69 6e 74 |int $p$ |to point|
|00001d40| 20 24 71 24 2e 7d 0a 5c | 6d 65 64 73 6b 69 70 0a | $q$.}.\|medskip.|
|00001d50| 5c 2b 5c 6f 70 20 76 6f | 69 64 20 64 72 61 77 5c |\+\op vo|id draw\|
|00001d60| 5f 73 65 67 6d 65 6e 74 | 20 7b 73 65 67 6d 65 6e |_segment| {segmen|
|00001d70| 74 5c 20 73 2c 5c 20 63 | 6f 6c 6f 72 5c 20 63 3d |t\ s,\ c|olor\ c=|
|00001d80| 62 6c 61 63 6b 7d 20 7b | 7d 0a 5c 2b 5c 6e 6f 70 |black} {|}.\+\nop|
|00001d90| 20 20 20 20 7b 64 72 61 | 77 73 20 6c 69 6e 65 20 | {dra|ws line |
|00001da0| 73 65 67 6d 65 6e 74 20 | 24 73 24 2e 7d 0a 0a 5c |segment |$s$.}..\|
|00001db0| 62 69 67 73 6b 69 70 0a | 7b 5c 62 66 20 33 2e 36 |bigskip.|{\bf 3.6|
|00001dc0| 20 44 72 61 77 69 6e 67 | 20 6c 69 6e 65 73 7d 0a | Drawing| lines}.|
|00001dd0| 5c 62 69 67 73 6b 69 70 | 0a 5c 2b 5c 6f 70 20 76 |\bigskip|.\+\op v|
|00001de0| 6f 69 64 20 64 72 61 77 | 5c 5f 6c 69 6e 65 20 7b |oid draw|\_line {|
|00001df0| 64 6f 75 62 6c 65 5c 20 | 78 5f 31 2c 5c 20 64 6f |double\ |x_1,\ do|
|00001e00| 75 62 6c 65 5c 20 79 5f | 31 2c 5c 20 64 6f 75 62 |uble\ y_|1,\ doub|
|00001e10| 6c 65 5c 20 78 5f 32 2c | 5c 20 64 6f 75 62 6c 65 |le\ x_2,|\ double|
|00001e20| 5c 20 79 5f 32 2c 5c 20 | 63 6f 6c 6f 72 5c 20 63 |\ y_2,\ |color\ c|
|00001e30| 3d 62 6c 61 63 6b 7d 20 | 7b 7d 0a 5c 2b 5c 6e 6f |=black} |{}.\+\no|
|00001e40| 70 20 20 20 20 7b 64 72 | 61 77 73 20 61 20 73 74 |p {dr|aws a st|
|00001e50| 72 61 69 67 68 74 20 6c | 69 6e 65 20 70 61 73 73 |raight l|ine pass|
|00001e60| 69 6e 67 20 74 68 72 6f | 75 67 68 20 70 6f 69 6e |ing thro|ugh poin|
|00001e70| 74 73 7d 0a 5c 2b 5c 6e | 6f 70 20 20 20 20 7b 24 |ts}.\+\n|op {$|
|00001e80| 28 78 5f 31 2c 79 5f 31 | 29 24 20 61 6e 64 20 24 |(x_1,y_1|)$ and $|
|00001e90| 28 78 5f 32 2c 79 5f 32 | 29 24 2e 7d 0a 5c 6d 65 |(x_2,y_2|)$.}.\me|
|00001ea0| 64 73 6b 69 70 0a 5c 2b | 5c 6f 70 20 76 6f 69 64 |dskip.\+|\op void|
|00001eb0| 20 64 72 61 77 5c 5f 6c | 69 6e 65 20 7b 70 6f 69 | draw\_l|ine {poi|
|00001ec0| 6e 74 5c 20 70 2c 5c 20 | 70 6f 69 6e 74 5c 20 71 |nt\ p,\ |point\ q|
|00001ed0| 2c 5c 20 63 6f 6c 6f 72 | 5c 20 63 3d 62 6c 61 63 |,\ color|\ c=blac|
|00001ee0| 6b 7d 20 7b 7d 0a 5c 2b | 5c 6e 6f 70 20 20 20 20 |k} {}.\+|\nop |
|00001ef0| 7b 64 72 61 77 73 20 61 | 20 73 74 72 61 69 67 68 |{draws a| straigh|
|00001f00| 74 20 6c 69 6e 65 20 70 | 61 73 73 69 6e 67 20 74 |t line p|assing t|
|00001f10| 68 72 6f 75 67 68 20 70 | 6f 69 6e 74 73 7d 0a 5c |hrough p|oints}.\|
|00001f20| 2b 5c 6e 6f 70 20 20 20 | 20 7b 24 70 24 20 61 6e |+\nop | {$p$ an|
|00001f30| 64 20 24 71 24 2e 7d 0a | 5c 6d 65 64 73 6b 69 70 |d $q$.}.|\medskip|
|00001f40| 0a 5c 2b 5c 6f 70 20 76 | 6f 69 64 20 64 72 61 77 |.\+\op v|oid draw|
|00001f50| 5c 5f 6c 69 6e 65 20 7b | 6c 69 6e 65 5c 20 6c 2c |\_line {|line\ l,|
|00001f60| 5c 20 63 6f 6c 6f 72 5c | 20 63 3d 62 6c 61 63 6b |\ color\| c=black|
|00001f70| 7d 20 7b 7d 0a 5c 2b 5c | 6e 6f 70 20 20 20 20 7b |} {}.\+\|nop {|
|00001f80| 64 72 61 77 73 20 6c 69 | 6e 65 20 24 6c 24 2e 7d |draws li|ne $l$.}|
|00001f90| 0a 5c 6d 65 64 73 6b 69 | 70 0a 5c 2b 5c 6f 70 20 |.\medski|p.\+\op |
|00001fa0| 76 6f 69 64 20 64 72 61 | 77 5c 5f 68 6c 69 6e 65 |void dra|w\_hline|
|00001fb0| 20 7b 64 6f 75 62 6c 65 | 5c 20 79 2c 5c 20 63 6f | {double|\ y,\ co|
|00001fc0| 6c 6f 72 5c 20 63 3d 62 | 6c 61 63 6b 7d 20 7b 7d |lor\ c=b|lack} {}|
|00001fd0| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 7b 64 72 61 77 |.\+\nop | {draw|
|00001fe0| 73 20 61 20 68 6f 72 69 | 7a 6f 6e 74 61 6c 20 6c |s a hori|zontal l|
|00001ff0| 69 6e 65 20 77 69 74 68 | 20 79 2d 63 6f 6f 72 64 |ine with| y-coord|
|00002000| 69 6e 61 74 65 20 24 79 | 24 2e 20 7d 0a 5c 6d 65 |inate $y|$. }.\me|
|00002010| 64 73 6b 69 70 0a 5c 2b | 5c 6f 70 20 76 6f 69 64 |dskip.\+|\op void|
|00002020| 20 64 72 61 77 5c 5f 76 | 6c 69 6e 65 20 7b 64 6f | draw\_v|line {do|
|00002030| 75 62 6c 65 5c 20 78 2c | 5c 20 63 6f 6c 6f 72 5c |uble\ x,|\ color\|
|00002040| 20 63 3d 62 6c 61 63 6b | 7d 20 7b 7d 0a 5c 2b 5c | c=black|} {}.\+\|
|00002050| 6e 6f 70 20 20 20 20 7b | 64 72 61 77 73 20 61 20 |nop {|draws a |
|00002060| 76 65 72 74 69 63 61 6c | 20 6c 69 6e 65 20 77 69 |vertical| line wi|
|00002070| 74 68 20 78 2d 63 6f 6f | 72 64 69 6e 61 74 65 20 |th x-coo|rdinate |
|00002080| 24 78 24 2e 20 7d 0a 0a | 0a 5c 62 69 67 73 6b 69 |$x$. }..|.\bigski|
|00002090| 70 0a 7b 5c 62 66 20 33 | 2e 37 20 44 72 61 77 69 |p.{\bf 3|.7 Drawi|
|000020a0| 6e 67 20 61 72 72 6f 77 | 73 7d 0a 5c 62 69 67 73 |ng arrow|s}.\bigs|
|000020b0| 6b 69 70 0a 5c 2b 5c 6f | 70 20 76 6f 69 64 20 64 |kip.\+\o|p void d|
|000020c0| 72 61 77 5c 5f 61 72 72 | 6f 77 20 7b 64 6f 75 62 |raw\_arr|ow {doub|
|000020d0| 6c 65 5c 20 78 5f 31 2c | 5c 20 64 6f 75 62 6c 65 |le\ x_1,|\ double|
|000020e0| 5c 20 79 5f 31 2c 5c 20 | 64 6f 75 62 6c 65 5c 20 |\ y_1,\ |double\ |
|000020f0| 78 5f 32 2c 5c 20 64 6f | 75 62 6c 65 5c 20 79 5f |x_2,\ do|uble\ y_|
|00002100| 32 2c 5c 20 63 6f 6c 6f | 72 5c 20 63 3d 62 6c 61 |2,\ colo|r\ c=bla|
|00002110| 63 6b 7d 20 7b 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 |ck} {}.\|+\nop |
|00002120| 20 7b 64 72 61 77 73 20 | 61 6e 20 61 72 72 6f 77 | {draws |an arrow|
|00002130| 20 70 6f 69 6e 74 69 6e | 67 20 66 72 6f 6d 20 24 | pointin|g from $|
|00002140| 28 78 5f 31 2c 79 5f 31 | 29 24 20 74 6f 20 24 28 |(x_1,y_1|)$ to $(|
|00002150| 78 5f 32 2c 79 5f 32 29 | 24 2e 7d 0a 5c 76 66 69 |x_2,y_2)|$.}.\vfi|
|00002160| 6c 6c 5c 65 6a 65 63 74 | 0a 0a 5c 2b 5c 6f 70 20 |ll\eject|..\+\op |
|00002170| 76 6f 69 64 20 64 72 61 | 77 5c 5f 61 72 72 6f 77 |void dra|w\_arrow|
|00002180| 20 7b 70 6f 69 6e 74 5c | 20 70 2c 5c 20 70 6f 69 | {point\| p,\ poi|
|00002190| 6e 74 5c 20 71 2c 5c 20 | 63 6f 6c 6f 72 5c 20 63 |nt\ q,\ |color\ c|
|000021a0| 3d 62 6c 61 63 6b 7d 20 | 7b 7d 0a 5c 2b 5c 6e 6f |=black} |{}.\+\no|
|000021b0| 70 20 20 20 20 7b 64 72 | 61 77 73 20 61 6e 20 61 |p {dr|aws an a|
|000021c0| 72 72 6f 77 20 70 6f 69 | 6e 74 69 6e 67 20 66 72 |rrow poi|nting fr|
|000021d0| 6f 6d 20 70 6f 69 6e 74 | 20 24 70 24 20 74 6f 20 |om point| $p$ to |
|000021e0| 70 6f 69 6e 74 20 24 71 | 24 2e 7d 0a 5c 6d 65 64 |point $q|$.}.\med|
|000021f0| 73 6b 69 70 0a 5c 2b 5c | 6f 70 20 76 6f 69 64 20 |skip.\+\|op void |
|00002200| 64 72 61 77 5c 5f 61 72 | 72 6f 77 20 7b 73 65 67 |draw\_ar|row {seg|
|00002210| 6d 65 6e 74 5c 20 73 2c | 5c 20 63 6f 6c 6f 72 5c |ment\ s,|\ color\|
|00002220| 20 63 3d 62 6c 61 63 6b | 7d 20 7b 7d 0a 5c 2b 5c | c=black|} {}.\+\|
|00002230| 6e 6f 70 20 20 20 20 7b | 64 72 61 77 73 20 61 6e |nop {|draws an|
|00002240| 20 61 72 72 6f 77 20 70 | 6f 69 6e 74 69 6e 67 20 | arrow p|ointing |
|00002250| 66 72 6f 6d 20 24 73 24 | 2e 73 74 61 72 74 28 29 |from $s$|.start()|
|00002260| 20 74 6f 20 24 73 24 2e | 65 6e 64 28 29 2e 7d 0a | to $s$.|end().}.|
|00002270| 0a 5c 62 69 67 73 6b 69 | 70 0a 7b 5c 62 66 20 33 |.\bigski|p.{\bf 3|
|00002280| 2e 38 20 44 72 61 77 69 | 6e 67 20 63 69 72 63 6c |.8 Drawi|ng circl|
|00002290| 65 73 7d 0a 5c 62 69 67 | 73 6b 69 70 0a 5c 2b 5c |es}.\big|skip.\+\|
|000022a0| 6f 70 20 76 6f 69 64 20 | 64 72 61 77 5c 5f 63 69 |op void |draw\_ci|
|000022b0| 72 63 6c 65 20 7b 64 6f | 75 62 6c 65 5c 20 78 2c |rcle {do|uble\ x,|
|000022c0| 5c 20 64 6f 75 62 6c 65 | 5c 20 79 2c 5c 20 64 6f |\ double|\ y,\ do|
|000022d0| 75 62 6c 65 5c 20 72 2c | 5c 20 63 6f 6c 6f 72 5c |uble\ r,|\ color\|
|000022e0| 20 63 20 3d 20 62 6c 61 | 63 6b 7d 20 7b 7d 0a 5c | c = bla|ck} {}.\|
|000022f0| 2b 5c 6e 6f 70 20 20 20 | 20 20 20 20 20 20 20 20 |+\nop | |
|00002300| 7b 64 72 61 77 73 20 74 | 68 65 20 63 69 72 63 6c |{draws t|he circl|
|00002310| 65 20 77 69 74 68 20 63 | 65 6e 74 65 72 20 24 28 |e with c|enter $(|
|00002320| 78 2c 79 29 24 20 61 6e | 64 20 72 61 64 69 75 73 |x,y)$ an|d radius|
|00002330| 20 24 72 24 2e 7d 0a 5c | 6d 65 64 73 6b 69 70 0a | $r$.}.\|medskip.|
|00002340| 5c 2b 5c 6f 70 20 76 6f | 69 64 20 64 72 61 77 5c |\+\op vo|id draw\|
|00002350| 5f 63 69 72 63 6c 65 20 | 7b 70 6f 69 6e 74 5c 20 |_circle |{point\ |
|00002360| 70 2c 5c 20 64 6f 75 62 | 6c 65 5c 20 72 2c 5c 20 |p,\ doub|le\ r,\ |
|00002370| 63 6f 6c 6f 72 5c 20 63 | 20 3d 20 62 6c 61 63 6b |color\ c| = black|
|00002380| 7d 20 7b 7d 0a 5c 2b 5c | 6e 6f 70 20 20 20 20 20 |} {}.\+\|nop |
|00002390| 20 20 20 20 20 20 7b 64 | 72 61 77 73 20 74 68 65 | {d|raws the|
|000023a0| 20 63 69 72 63 6c 65 20 | 77 69 74 68 20 63 65 6e | circle |with cen|
|000023b0| 74 65 72 20 24 70 24 20 | 61 6e 64 20 72 61 64 69 |ter $p$ |and radi|
|000023c0| 75 73 20 24 72 24 2e 7d | 0a 5c 6d 65 64 73 6b 69 |us $r$.}|.\medski|
|000023d0| 70 0a 5c 2b 5c 6f 70 20 | 76 6f 69 64 20 64 72 61 |p.\+\op |void dra|
|000023e0| 77 5c 5f 63 69 72 63 6c | 65 20 7b 63 69 72 63 6c |w\_circl|e {circl|
|000023f0| 65 5c 20 43 2c 5c 20 63 | 6f 6c 6f 72 5c 20 63 20 |e\ C,\ c|olor\ c |
|00002400| 3d 20 62 6c 61 63 6b 7d | 20 7b 7d 0a 5c 2b 5c 6e |= black}| {}.\+\n|
|00002410| 6f 70 20 20 20 20 20 20 | 20 20 20 20 20 7b 64 72 |op | {dr|
|00002420| 61 77 73 20 63 69 72 63 | 6c 65 20 24 43 24 2e 7d |aws circ|le $C$.}|
|00002430| 0a 0a 5c 62 69 67 73 6b | 69 70 0a 7b 5c 62 66 20 |..\bigsk|ip.{\bf |
|00002440| 33 2e 39 20 44 72 61 77 | 69 6e 67 20 64 69 73 63 |3.9 Draw|ing disc|
|00002450| 73 7d 0a 5c 62 69 67 73 | 6b 69 70 0a 5c 2b 5c 6f |s}.\bigs|kip.\+\o|
|00002460| 70 20 76 6f 69 64 20 64 | 72 61 77 5c 5f 64 69 73 |p void d|raw\_dis|
|00002470| 63 20 7b 64 6f 75 62 6c | 65 5c 20 78 2c 5c 20 64 |c {doubl|e\ x,\ d|
|00002480| 6f 75 62 6c 65 5c 20 79 | 2c 5c 20 64 6f 75 62 6c |ouble\ y|,\ doubl|
|00002490| 65 5c 20 72 2c 5c 20 63 | 6f 6c 6f 72 5c 20 63 20 |e\ r,\ c|olor\ c |
|000024a0| 3d 20 62 6c 61 63 6b 7d | 20 7b 7d 0a 5c 2b 5c 6e |= black}| {}.\+\n|
|000024b0| 6f 70 20 20 20 20 20 20 | 20 20 20 20 20 7b 64 72 |op | {dr|
|000024c0| 61 77 73 20 61 20 66 69 | 6c 6c 65 64 20 63 69 72 |aws a fi|lled cir|
|000024d0| 63 6c 65 20 77 69 74 68 | 20 63 65 6e 74 65 72 20 |cle with| center |
|000024e0| 24 28 78 2c 79 29 24 20 | 61 6e 64 20 72 61 64 69 |$(x,y)$ |and radi|
|000024f0| 75 73 20 24 72 24 2e 7d | 0a 5c 6d 65 64 73 6b 69 |us $r$.}|.\medski|
|00002500| 70 0a 5c 2b 5c 6f 70 20 | 76 6f 69 64 20 64 72 61 |p.\+\op |void dra|
|00002510| 77 5c 5f 64 69 73 63 20 | 7b 70 6f 69 6e 74 5c 20 |w\_disc |{point\ |
|00002520| 70 2c 5c 20 64 6f 75 62 | 6c 65 5c 20 72 2c 5c 20 |p,\ doub|le\ r,\ |
|00002530| 63 6f 6c 6f 72 5c 20 63 | 20 3d 20 62 6c 61 63 6b |color\ c| = black|
|00002540| 7d 20 7b 7d 0a 5c 2b 5c | 6e 6f 70 20 20 20 20 20 |} {}.\+\|nop |
|00002550| 20 20 20 20 20 20 7b 64 | 72 61 77 73 20 61 20 66 | {d|raws a f|
|00002560| 69 6c 6c 65 64 20 63 69 | 72 63 6c 65 20 77 69 74 |illed ci|rcle wit|
|00002570| 68 20 63 65 6e 74 65 72 | 20 24 70 24 20 61 6e 64 |h center| $p$ and|
|00002580| 20 72 61 64 69 75 73 20 | 24 72 24 2e 7d 0a 5c 6d | radius |$r$.}.\m|
|00002590| 65 64 73 6b 69 70 0a 5c | 2b 5c 6f 70 20 76 6f 69 |edskip.\|+\op voi|
|000025a0| 64 20 64 72 61 77 5c 5f | 64 69 73 63 20 7b 63 69 |d draw\_|disc {ci|
|000025b0| 72 63 6c 65 5c 20 43 2c | 5c 20 63 6f 6c 6f 72 5c |rcle\ C,|\ color\|
|000025c0| 20 63 20 3d 20 62 6c 61 | 63 6b 7d 20 7b 7d 0a 5c | c = bla|ck} {}.\|
|000025d0| 2b 5c 6e 6f 70 20 20 20 | 20 20 20 20 20 20 20 20 |+\nop | |
|000025e0| 7b 64 72 61 77 73 20 66 | 69 6c 6c 65 64 20 63 69 |{draws f|illed ci|
|000025f0| 72 63 6c 65 20 24 43 24 | 2e 7d 0a 5c 6d 65 64 73 |rcle $C$|.}.\meds|
|00002600| 6b 69 70 0a 0a 5c 62 69 | 67 73 6b 69 70 0a 7b 5c |kip..\bi|gskip.{\|
|00002610| 62 66 20 33 2e 31 30 20 | 44 72 61 77 69 6e 67 20 |bf 3.10 |Drawing |
|00002620| 70 6f 6c 79 67 6f 6e 73 | 20 7d 0a 5c 62 69 67 73 |polygons| }.\bigs|
|00002630| 6b 69 70 0a 5c 2b 5c 6f | 70 20 76 6f 69 64 20 64 |kip.\+\o|p void d|
|00002640| 72 61 77 5c 5f 70 6f 6c | 79 67 6f 6e 20 7b 6c 69 |raw\_pol|ygon {li|
|00002650| 73 74 5c 3c 70 6f 69 6e | 74 5c 3e 5c 20 6c 70 2c |st\<poin|t\>\ lp,|
|00002660| 5c 20 63 6f 6c 6f 72 5c | 20 63 3d 62 6c 61 63 6b |\ color\| c=black|
|00002670| 7d 20 7b 7d 0a 5c 2b 5c | 6e 6f 70 20 7b 64 72 61 |} {}.\+\|nop {dra|
|00002680| 77 73 20 74 68 65 20 70 | 6f 6c 79 67 6f 6e 20 77 |ws the p|olygon w|
|00002690| 69 74 68 20 76 65 72 74 | 65 78 20 73 65 71 75 65 |ith vert|ex seque|
|000026a0| 6e 63 65 20 24 6c 70 24 | 2e 7d 0a 5c 6d 65 64 73 |nce $lp$|.}.\meds|
|000026b0| 6b 69 70 0a 5c 2b 5c 6f | 70 20 76 6f 69 64 20 64 |kip.\+\o|p void d|
|000026c0| 72 61 77 5c 5f 70 6f 6c | 79 67 6f 6e 20 7b 70 6f |raw\_pol|ygon {po|
|000026d0| 6c 79 67 6f 6e 5c 20 50 | 2c 5c 20 63 6f 6c 6f 72 |lygon\ P|,\ color|
|000026e0| 5c 20 63 3d 62 6c 61 63 | 6b 7d 20 7b 7d 0a 5c 2b |\ c=blac|k} {}.\+|
|000026f0| 5c 6e 6f 70 20 7b 64 72 | 61 77 73 20 70 6f 6c 79 |\nop {dr|aws poly|
|00002700| 67 6f 6e 20 24 50 24 2e | 7d 0a 5c 6d 65 64 73 6b |gon $P$.|}.\medsk|
|00002710| 69 70 0a 5c 2b 5c 6f 70 | 20 76 6f 69 64 20 64 72 |ip.\+\op| void dr|
|00002720| 61 77 5c 5f 66 69 6c 6c | 65 64 5c 5f 70 6f 6c 79 |aw\_fill|ed\_poly|
|00002730| 67 6f 6e 20 7b 6c 69 73 | 74 5c 3c 70 6f 69 6e 74 |gon {lis|t\<point|
|00002740| 5c 3e 5c 20 6c 70 2c 5c | 20 63 6f 6c 6f 72 5c 20 |\>\ lp,\| color\ |
|00002750| 63 3d 62 6c 61 63 6b 7d | 20 7b 7d 0a 5c 2b 5c 6e |c=black}| {}.\+\n|
|00002760| 6f 70 20 7b 64 72 61 77 | 73 20 74 68 65 20 66 69 |op {draw|s the fi|
|00002770| 6c 6c 65 64 20 70 6f 6c | 79 67 6f 6e 20 77 69 74 |lled pol|ygon wit|
|00002780| 68 20 76 65 72 74 65 78 | 20 73 65 71 75 65 6e 63 |h vertex| sequenc|
|00002790| 65 20 24 6c 70 24 2e 7d | 0a 5c 6d 65 64 73 6b 69 |e $lp$.}|.\medski|
|000027a0| 70 0a 5c 2b 5c 6f 70 20 | 76 6f 69 64 20 64 72 61 |p.\+\op |void dra|
|000027b0| 77 5c 5f 66 69 6c 6c 65 | 64 5c 5f 70 6f 6c 79 67 |w\_fille|d\_polyg|
|000027c0| 6f 6e 20 7b 70 6f 6c 79 | 67 6f 6e 5c 20 50 2c 5c |on {poly|gon\ P,\|
|000027d0| 20 63 6f 6c 6f 72 5c 20 | 63 3d 62 6c 61 63 6b 7d | color\ |c=black}|
|000027e0| 20 7b 7d 0a 5c 2b 5c 6e | 6f 70 20 7b 64 72 61 77 | {}.\+\n|op {draw|
|000027f0| 73 20 66 69 6c 6c 65 64 | 20 70 6f 6c 79 67 6f 6e |s filled| polygon|
|00002800| 20 24 50 24 2e 7d 0a 5c | 6d 65 64 73 6b 69 70 0a | $P$.}.\|medskip.|
|00002810| 0a 5c 76 66 69 6c 6c 5c | 65 6a 65 63 74 0a 0a 5c |.\vfill\|eject..\|
|00002820| 62 69 67 73 6b 69 70 0a | 7b 5c 62 66 20 33 2e 31 |bigskip.|{\bf 3.1|
|00002830| 31 20 44 72 61 77 69 6e | 67 20 66 75 6e 63 74 69 |1 Drawin|g functi|
|00002840| 6f 6e 73 7d 0a 5c 62 69 | 67 73 6b 69 70 0a 5c 2b |ons}.\bi|gskip.\+|
|00002850| 5c 6f 70 20 76 6f 69 64 | 20 70 6c 6f 74 5c 5f 78 |\op void| plot\_x|
|00002860| 79 20 7b 64 6f 75 62 6c | 65 5c 20 78 5f 30 2c 5c |y {doubl|e\ x_0,\|
|00002870| 20 64 6f 75 62 6c 65 5c | 20 78 5f 31 2c 5c 20 28 | double\| x_1,\ (|
|00002880| 64 6f 75 62 6c 65 29 28 | 2a 46 29 28 64 6f 75 62 |double)(|*F)(doub|
|00002890| 6c 65 29 2c 5c 20 63 6f | 6c 6f 72 5c 20 63 20 3d |le),\ co|lor\ c =|
|000028a0| 20 62 6c 61 63 6b 7d 20 | 7b 7d 0a 5c 2b 5c 6e 6f | black} |{}.\+\no|
|000028b0| 70 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |p | |
|000028c0| 7b 64 72 61 77 73 20 66 | 75 6e 63 74 69 6f 6e 20 |{draws f|unction |
|000028d0| 24 46 24 20 69 6e 20 72 | 61 6e 67 65 20 24 5b 78 |$F$ in r|ange $[x|
|000028e0| 5f 30 2c 78 5f 31 5d 24 | 2c 20 69 2e 65 2e 2c 20 |_0,x_1]$|, i.e., |
|000028f0| 61 6c 6c 20 70 6f 69 6e | 74 73 7d 0a 5c 2b 5c 6e |all poin|ts}.\+\n|
|00002900| 6f 70 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |op | |
|00002910| 20 7b 24 28 78 2c 79 29 | 24 20 77 69 74 68 20 24 | {$(x,y)|$ with $|
|00002920| 79 20 3d 20 46 28 78 29 | 24 20 61 6e 64 20 24 78 |y = F(x)|$ and $x|
|00002930| 5f 30 5c 6c 65 20 78 5c | 6c 65 20 78 5f 31 24 7d |_0\le x\|le x_1$}|
|00002940| 0a 5c 6d 65 64 73 6b 69 | 70 0a 5c 2b 5c 6f 70 20 |.\medski|p.\+\op |
|00002950| 76 6f 69 64 20 70 6c 6f | 74 5c 5f 79 78 20 7b 64 |void plo|t\_yx {d|
|00002960| 6f 75 62 6c 65 5c 20 79 | 5f 30 2c 5c 20 64 6f 75 |ouble\ y|_0,\ dou|
|00002970| 62 6c 65 5c 20 79 5f 31 | 2c 5c 20 28 64 6f 75 62 |ble\ y_1|,\ (doub|
|00002980| 6c 65 29 28 2a 46 29 28 | 64 6f 75 62 6c 65 29 2c |le)(*F)(|double),|
|00002990| 5c 20 63 6f 6c 6f 72 5c | 20 63 20 3d 20 62 6c 61 |\ color\| c = bla|
|000029a0| 63 6b 7d 20 7b 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 |ck} {}.\|+\nop |
|000029b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 7b 64 72 61 | | {dra|
|000029c0| 77 73 20 66 75 6e 63 74 | 69 6f 6e 20 24 46 24 20 |ws funct|ion $F$ |
|000029d0| 69 6e 20 72 61 6e 67 65 | 20 24 5b 79 5f 30 2c 79 |in range| $[y_0,y|
|000029e0| 5f 31 5d 24 2c 20 69 2e | 65 2e 2c 20 61 6c 6c 20 |_1]$, i.|e., all |
|000029f0| 70 6f 69 6e 74 73 7d 0a | 5c 2b 5c 6e 6f 70 20 20 |points}.|\+\nop |
|00002a00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 7b 24 28 | | {$(|
|00002a10| 78 2c 79 29 24 20 77 69 | 74 68 20 24 78 20 3d 20 |x,y)$ wi|th $x = |
|00002a20| 46 28 79 29 24 20 61 6e | 64 20 24 79 5f 30 5c 6c |F(y)$ an|d $y_0\l|
|00002a30| 65 20 79 5c 6c 65 20 79 | 5f 31 24 7d 0a 0a 0a 5c |e y\le y|_1$}...\|
|00002a40| 62 69 67 73 6b 69 70 0a | 7b 5c 62 66 20 33 2e 31 |bigskip.|{\bf 3.1|
|00002a50| 32 20 44 72 61 77 69 6e | 67 20 74 65 78 74 7d 0a |2 Drawin|g text}.|
|00002a60| 5c 62 69 67 73 6b 69 70 | 0a 5c 2b 5c 6f 70 20 76 |\bigskip|.\+\op v|
|00002a70| 6f 69 64 20 64 72 61 77 | 5c 5f 74 65 78 74 20 7b |oid draw|\_text {|
|00002a80| 64 6f 75 62 6c 65 5c 20 | 78 2c 5c 20 64 6f 75 62 |double\ |x,\ doub|
|00002a90| 6c 65 5c 20 79 2c 5c 20 | 73 74 72 69 6e 67 5c 20 |le\ y,\ |string\ |
|00002aa0| 73 2c 5c 20 63 6f 6c 6f | 72 5c 20 63 20 3d 20 62 |s,\ colo|r\ c = b|
|00002ab0| 6c 61 63 6b 7d 20 7b 7d | 0a 5c 2b 5c 6e 6f 70 20 |lack} {}|.\+\nop |
|00002ac0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 7b 77 | | {w|
|00002ad0| 72 69 74 65 73 20 73 74 | 72 69 6e 67 20 24 73 24 |rites st|ring $s$|
|00002ae0| 20 73 74 61 72 74 69 6e | 67 20 61 74 20 70 6f 73 | startin|g at pos|
|00002af0| 69 74 69 6f 6e 20 24 28 | 78 2c 79 29 24 2e 7d 0a |ition $(|x,y)$.}.|
|00002b00| 5c 6d 65 64 73 6b 69 70 | 0a 5c 2b 5c 6f 70 20 76 |\medskip|.\+\op v|
|00002b10| 6f 69 64 20 64 72 61 77 | 5c 5f 74 65 78 74 20 7b |oid draw|\_text {|
|00002b20| 70 6f 69 6e 74 5c 20 70 | 2c 5c 20 73 74 72 69 6e |point\ p|,\ strin|
|00002b30| 67 5c 20 73 2c 5c 20 63 | 6f 6c 6f 72 5c 20 63 20 |g\ s,\ c|olor\ c |
|00002b40| 3d 20 62 6c 61 63 6b 7d | 20 7b 7d 0a 5c 2b 5c 6e |= black}| {}.\+\n|
|00002b50| 6f 70 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |op | |
|00002b60| 20 7b 77 72 69 74 65 73 | 20 73 74 72 69 6e 67 20 | {writes| string |
|00002b70| 24 73 24 20 73 74 61 72 | 74 69 6e 67 20 61 74 20 |$s$ star|ting at |
|00002b80| 70 6f 73 69 74 69 6f 6e | 20 24 70 24 2e 7d 0a 5c |position| $p$.}.\|
|00002b90| 6d 65 64 73 6b 69 70 0a | 5c 2b 5c 6f 70 20 76 6f |medskip.|\+\op vo|
|00002ba0| 69 64 20 64 72 61 77 5c | 5f 63 74 65 78 74 20 7b |id draw\|_ctext {|
|00002bb0| 64 6f 75 62 6c 65 5c 20 | 78 2c 5c 20 64 6f 75 62 |double\ |x,\ doub|
|00002bc0| 6c 65 5c 20 79 2c 5c 20 | 73 74 72 69 6e 67 5c 20 |le\ y,\ |string\ |
|00002bd0| 73 2c 5c 20 63 6f 6c 6f | 72 5c 20 63 20 3d 20 62 |s,\ colo|r\ c = b|
|00002be0| 6c 61 63 6b 7d 20 7b 7d | 0a 5c 2b 5c 6e 6f 70 20 |lack} {}|.\+\nop |
|00002bf0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 7b 77 | | {w|
|00002c00| 72 69 74 65 73 20 73 74 | 72 69 6e 67 20 24 73 24 |rites st|ring $s$|
|00002c10| 20 63 65 6e 74 65 72 65 | 64 20 61 74 20 70 6f 73 | centere|d at pos|
|00002c20| 69 74 69 6f 6e 20 24 28 | 78 2c 79 29 24 2e 7d 0a |ition $(|x,y)$.}.|
|00002c30| 5c 6d 65 64 73 6b 69 70 | 0a 5c 2b 5c 6f 70 20 76 |\medskip|.\+\op v|
|00002c40| 6f 69 64 20 64 72 61 77 | 5c 5f 63 74 65 78 74 20 |oid draw|\_ctext |
|00002c50| 7b 70 6f 69 6e 74 5c 20 | 70 2c 5c 20 73 74 72 69 |{point\ |p,\ stri|
|00002c60| 6e 67 5c 20 73 2c 5c 20 | 63 6f 6c 6f 72 5c 20 63 |ng\ s,\ |color\ c|
|00002c70| 20 3d 20 62 6c 61 63 6b | 7d 20 7b 7d 0a 5c 2b 5c | = black|} {}.\+\|
|00002c80| 6e 6f 70 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |nop | |
|00002c90| 20 20 7b 77 72 69 74 65 | 73 20 73 74 72 69 6e 67 | {write|s string|
|00002ca0| 20 24 73 24 20 63 65 6e | 74 65 72 65 64 20 61 74 | $s$ cen|tered at|
|00002cb0| 20 70 6f 73 69 74 69 6f | 6e 20 24 70 24 2e 7d 0a | positio|n $p$.}.|
|00002cc0| 0a 0a 0a 0a 5c 62 69 67 | 73 6b 69 70 0a 7b 5c 62 |....\big|skip.{\b|
|00002cd0| 66 20 33 2e 31 33 20 44 | 72 61 77 69 6e 67 20 6e |f 3.13 D|rawing n|
|00002ce0| 6f 64 65 73 7d 0a 25 4e | 6f 64 65 73 20 61 72 65 |odes}.%N|odes are|
|00002cf0| 20 63 69 72 63 6c 65 73 | 20 6f 66 20 64 69 61 6d | circles| of diam|
|00002d00| 65 74 65 72 20 24 6e 6f | 64 65 5c 5f 77 69 64 74 |eter $no|de\_widt|
|00002d10| 68 24 2e 0a 5c 62 69 67 | 73 6b 69 70 0a 5c 2b 5c |h$..\big|skip.\+\|
|00002d20| 6f 70 20 76 6f 69 64 20 | 64 72 61 77 5c 5f 6e 6f |op void |draw\_no|
|00002d30| 64 65 20 7b 64 6f 75 62 | 6c 65 5c 20 20 78 5f 30 |de {doub|le\ x_0|
|00002d40| 2c 5c 20 64 6f 75 62 6c | 65 5c 20 79 5f 30 2c 5c |,\ doubl|e\ y_0,\|
|00002d50| 20 63 6f 6c 6f 72 5c 20 | 63 20 3d 20 62 6c 61 63 | color\ |c = blac|
|00002d60| 6b 7d 20 7b 7d 0a 5c 2b | 5c 6e 6f 70 20 20 20 20 |k} {}.\+|\nop |
|00002d70| 20 20 20 20 20 20 20 20 | 20 20 20 7b 64 72 61 77 | | {draw|
|00002d80| 73 20 61 20 6e 6f 64 65 | 20 61 74 20 70 6f 73 69 |s a node| at posi|
|00002d90| 74 69 6f 6e 20 24 28 78 | 5f 30 2c 79 5f 30 29 24 |tion $(x|_0,y_0)$|
|00002da0| 2e 7d 0a 5c 6d 65 64 73 | 6b 69 70 0a 5c 2b 5c 6f |.}.\meds|kip.\+\o|
|00002db0| 70 20 76 6f 69 64 20 64 | 72 61 77 5c 5f 6e 6f 64 |p void d|raw\_nod|
|00002dc0| 65 20 7b 70 6f 69 6e 74 | 5c 20 70 2c 5c 20 63 6f |e {point|\ p,\ co|
|00002dd0| 6c 6f 72 5c 20 63 20 3d | 20 62 6c 61 63 6b 7d 20 |lor\ c =| black} |
|00002de0| 7b 7d 0a 5c 2b 5c 6e 6f | 70 20 20 20 20 20 20 20 |{}.\+\no|p |
|00002df0| 20 20 20 20 20 20 20 20 | 7b 64 72 61 77 73 20 61 | |{draws a|
|00002e00| 20 6e 6f 64 65 20 61 74 | 20 70 6f 73 69 74 69 6f | node at| positio|
|00002e10| 6e 20 24 70 24 2e 7d 0a | 5c 6d 65 64 73 6b 69 70 |n $p$.}.|\medskip|
|00002e20| 0a 5c 2b 5c 6f 70 20 76 | 6f 69 64 20 64 72 61 77 |.\+\op v|oid draw|
|00002e30| 5c 5f 66 69 6c 6c 65 64 | 5c 5f 6e 6f 64 65 20 7b |\_filled|\_node {|
|00002e40| 64 6f 75 62 6c 65 5c 20 | 20 78 5f 30 2c 5c 20 64 |double\ | x_0,\ d|
|00002e50| 6f 75 62 6c 65 5c 20 20 | 79 5f 30 2c 5c 20 63 6f |ouble\ |y_0,\ co|
|00002e60| 6c 6f 72 5c 20 63 20 3d | 20 62 6c 61 63 6b 7d 20 |lor\ c =| black} |
|00002e70| 7b 7d 0a 5c 2b 5c 6e 6f | 70 20 20 20 20 20 20 20 |{}.\+\no|p |
|00002e80| 20 20 20 20 20 20 20 20 | 7b 64 72 61 77 73 20 61 | |{draws a|
|00002e90| 20 66 69 6c 6c 65 64 20 | 6e 6f 64 65 20 61 74 20 | filled |node at |
|00002ea0| 70 6f 73 69 74 69 6f 6e | 20 24 28 78 5f 30 2c 79 |position| $(x_0,y|
|00002eb0| 5f 30 29 24 2e 7d 0a 5c | 6d 65 64 73 6b 69 70 0a |_0)$.}.\|medskip.|
|00002ec0| 5c 2b 5c 6f 70 20 76 6f | 69 64 20 64 72 61 77 5c |\+\op vo|id draw\|
|00002ed0| 5f 66 69 6c 6c 65 64 5c | 5f 6e 6f 64 65 20 7b 70 |_filled\|_node {p|
|00002ee0| 6f 69 6e 74 5c 20 70 2c | 5c 20 63 6f 6c 6f 72 5c |oint\ p,|\ color\|
|00002ef0| 20 63 20 3d 20 62 6c 61 | 63 6b 7d 20 7b 7d 0a 5c | c = bla|ck} {}.\|
|00002f00| 2b 5c 6e 6f 70 20 20 20 | 20 20 20 20 20 20 20 20 |+\nop | |
|00002f10| 20 20 20 20 7b 64 72 61 | 77 73 20 61 20 66 69 6c | {dra|ws a fil|
|00002f20| 6c 65 64 20 6e 6f 64 65 | 20 61 74 20 70 6f 73 69 |led node| at posi|
|00002f30| 74 69 6f 6e 20 24 70 24 | 2e 7d 0a 5c 6d 65 64 73 |tion $p$|.}.\meds|
|00002f40| 6b 69 70 0a 5c 2b 5c 6f | 70 20 76 6f 69 64 20 64 |kip.\+\o|p void d|
|00002f50| 72 61 77 5c 5f 74 65 78 | 74 5c 5f 6e 6f 64 65 20 |raw\_tex|t\_node |
|00002f60| 7b 64 6f 75 62 6c 65 5c | 20 20 78 2c 5c 20 64 6f |{double\| x,\ do|
|00002f70| 75 62 6c 65 5c 20 20 79 | 2c 5c 20 73 74 72 69 6e |uble\ y|,\ strin|
|00002f80| 67 5c 20 73 2c 5c 20 63 | 6f 6c 6f 72 5c 20 63 20 |g\ s,\ c|olor\ c |
|00002f90| 3d 20 62 6c 61 63 6b 7d | 20 7b 7d 0a 5c 2b 5c 6e |= black}| {}.\+\n|
|00002fa0| 6f 70 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |op | |
|00002fb0| 20 7b 64 72 61 77 73 20 | 61 20 6e 6f 64 65 20 77 | {draws |a node w|
|00002fc0| 69 74 68 20 6c 61 62 65 | 6c 20 24 73 24 20 61 74 |ith labe|l $s$ at|
|00002fd0| 20 70 6f 73 69 74 69 6f | 6e 20 24 28 78 5f 30 2c | positio|n $(x_0,|
|00002fe0| 79 5f 30 29 24 2e 20 7d | 0a 5c 6d 65 64 73 6b 69 |y_0)$. }|.\medski|
|00002ff0| 70 0a 5c 2b 5c 6f 70 20 | 76 6f 69 64 20 64 72 61 |p.\+\op |void dra|
|00003000| 77 5c 5f 74 65 78 74 5c | 5f 6e 6f 64 65 20 7b 70 |w\_text\|_node {p|
|00003010| 6f 69 6e 74 5c 20 70 2c | 5c 20 73 74 72 69 6e 67 |oint\ p,|\ string|
|00003020| 5c 20 73 2c 5c 20 63 6f | 6c 6f 72 5c 20 63 20 3d |\ s,\ co|lor\ c =|
|00003030| 20 62 6c 61 63 6b 7d 20 | 7b 7d 0a 5c 2b 5c 6e 6f | black} |{}.\+\no|
|00003040| 70 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |p | |
|00003050| 7b 64 72 61 77 73 20 61 | 20 6e 6f 64 65 20 77 69 |{draws a| node wi|
|00003060| 74 68 20 6c 61 62 65 6c | 20 24 73 24 20 61 74 20 |th label| $s$ at |
|00003070| 70 6f 73 69 74 69 6f 6e | 20 24 70 24 2e 20 7d 0a |position| $p$. }.|
|00003080| 5c 6d 65 64 73 6b 69 70 | 0a 5c 2b 5c 6f 70 20 76 |\medskip|.\+\op v|
|00003090| 6f 69 64 20 64 72 61 77 | 5c 5f 69 6e 74 5c 5f 6e |oid draw|\_int\_n|
|000030a0| 6f 64 65 20 7b 64 6f 75 | 62 6c 65 5c 20 20 78 2c |ode {dou|ble\ x,|
|000030b0| 5c 20 64 6f 75 62 6c 65 | 5c 20 20 79 2c 5c 20 69 |\ double|\ y,\ i|
|000030c0| 6e 74 5c 20 69 2c 5c 20 | 63 6f 6c 6f 72 5c 20 63 |nt\ i,\ |color\ c|
|000030d0| 20 3d 20 62 6c 61 63 6b | 7d 20 7b 7d 0a 5c 2b 5c | = black|} {}.\+\|
|000030e0| 6e 6f 70 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |nop | |
|000030f0| 20 20 7b 64 72 61 77 73 | 20 61 20 6e 6f 64 65 20 | {draws| a node |
|00003100| 77 69 74 68 20 69 6e 74 | 65 67 65 72 20 6c 61 62 |with int|eger lab|
|00003110| 65 6c 20 24 69 24 20 61 | 74 20 70 6f 73 69 74 69 |el $i$ a|t positi|
|00003120| 6f 6e 20 7d 0a 5c 2b 5c | 6e 6f 70 20 20 20 20 20 |on }.\+\|nop |
|00003130| 20 20 20 20 20 20 20 20 | 20 20 7b 24 28 78 5f 30 | | {$(x_0|
|00003140| 2c 79 5f 30 29 24 2e 20 | 7d 0a 5c 6d 65 64 73 6b |,y_0)$. |}.\medsk|
|00003150| 69 70 0a 5c 2b 5c 6f 70 | 20 76 6f 69 64 20 64 72 |ip.\+\op| void dr|
|00003160| 61 77 5c 5f 69 6e 74 5c | 5f 6e 6f 64 65 20 7b 70 |aw\_int\|_node {p|
|00003170| 6f 69 6e 74 5c 20 70 2c | 5c 20 69 6e 74 5c 20 69 |oint\ p,|\ int\ i|
|00003180| 2c 5c 20 63 6f 6c 6f 72 | 5c 20 63 20 3d 20 62 6c |,\ color|\ c = bl|
|00003190| 61 63 6b 7d 20 7b 7d 0a | 5c 2b 5c 6e 6f 70 20 20 |ack} {}.|\+\nop |
|000031a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 7b 64 72 | | {dr|
|000031b0| 61 77 73 20 61 20 6e 6f | 64 65 20 77 69 74 68 20 |aws a no|de with |
|000031c0| 69 6e 74 65 67 65 72 20 | 6c 61 62 65 6c 20 24 69 |integer |label $i|
|000031d0| 24 20 61 74 20 70 6f 73 | 69 74 69 6f 6e 20 20 24 |$ at pos|ition $|
|000031e0| 70 24 2e 20 7d 0a 0a 5c | 62 69 67 73 6b 69 70 0a |p$. }..\|bigskip.|
|000031f0| 7b 5c 62 66 20 33 2e 31 | 34 20 44 72 61 77 69 6e |{\bf 3.1|4 Drawin|
|00003200| 67 20 65 64 67 65 73 7d | 0a 25 45 64 67 65 73 20 |g edges}|.%Edges |
|00003210| 61 72 65 20 73 74 72 61 | 69 67 74 68 20 6c 69 6e |are stra|igth lin|
|00003220| 65 20 73 65 67 6d 65 6e | 74 73 20 6f 72 20 61 72 |e segmen|ts or ar|
|00003230| 72 6f 77 73 20 77 69 74 | 68 20 61 20 63 6c 65 61 |rows wit|h a clea|
|00003240| 72 61 6e 63 65 20 6f 66 | 20 0a 25 24 6e 6f 64 65 |rance of| .%$node|
|00003250| 5c 5f 77 69 64 74 68 2f | 32 24 20 61 74 20 65 61 |\_width/|2$ at ea|
|00003260| 63 68 20 65 6e 64 2e 0a | 5c 62 69 67 73 6b 69 70 |ch end..|\bigskip|
|00003270| 0a 5c 2b 5c 6f 70 20 76 | 6f 69 64 20 64 72 61 77 |.\+\op v|oid draw|
|00003280| 5c 5f 65 64 67 65 20 7b | 64 6f 75 62 6c 65 5c 20 |\_edge {|double\ |
|00003290| 20 78 5f 31 2c 20 5c 20 | 64 6f 75 62 6c 65 5c 20 | x_1, \ |double\ |
|000032a0| 79 5f 31 2c 20 5c 20 64 | 6f 75 62 6c 65 5c 20 78 |y_1, \ d|ouble\ x|
|000032b0| 5f 32 2c 20 5c 20 64 6f | 75 62 6c 65 5c 20 79 5f |_2, \ do|uble\ y_|
|000032c0| 32 2c 5c 20 63 6f 6c 6f | 72 5c 20 63 20 3d 20 62 |2,\ colo|r\ c = b|
|000032d0| 6c 61 63 6b 7d 20 7b 7d | 0a 5c 2b 5c 6e 6f 70 20 |lack} {}|.\+\nop |
|000032e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 7b 64 | | {d|
|000032f0| 72 61 77 73 20 61 6e 20 | 65 64 67 65 20 66 72 6f |raws an |edge fro|
|00003300| 6d 20 24 28 78 5f 31 2c | 79 5f 31 29 24 20 74 6f |m $(x_1,|y_1)$ to|
|00003310| 20 24 28 78 5f 32 2c 79 | 5f 32 29 24 2e 7d 0a 5c | $(x_2,y|_2)$.}.\|
|00003320| 6d 65 64 73 6b 69 70 0a | 5c 2b 5c 6f 70 20 76 6f |medskip.|\+\op vo|
|00003330| 69 64 20 64 72 61 77 5c | 5f 65 64 67 65 20 7b 70 |id draw\|_edge {p|
|00003340| 6f 69 6e 74 5c 20 70 2c | 5c 20 70 6f 69 6e 74 5c |oint\ p,|\ point\|
|00003350| 20 71 2c 5c 20 63 6f 6c | 6f 72 5c 20 63 20 3d 20 | q,\ col|or\ c = |
|00003360| 62 6c 61 63 6b 7d 20 7b | 7d 0a 5c 2b 5c 6e 6f 70 |black} {|}.\+\nop|
|00003370| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 7b | | {|
|00003380| 64 72 61 77 73 20 61 6e | 20 65 64 67 65 20 66 72 |draws an| edge fr|
|00003390| 6f 6d 20 24 70 24 20 74 | 6f 20 24 71 24 2e 7d 0a |om $p$ t|o $q$.}.|
|000033a0| 5c 6d 65 64 73 6b 69 70 | 0a 5c 2b 5c 6f 70 20 76 |\medskip|.\+\op v|
|000033b0| 6f 69 64 20 64 72 61 77 | 5c 5f 65 64 67 65 20 7b |oid draw|\_edge {|
|000033c0| 73 65 67 6d 65 6e 74 5c | 20 73 2c 5c 20 63 6f 6c |segment\| s,\ col|
|000033d0| 6f 72 5c 20 63 20 3d 20 | 62 6c 61 63 6b 7d 20 7b |or\ c = |black} {|
|000033e0| 7d 0a 5c 2b 5c 6e 6f 70 | 20 20 20 20 20 20 20 20 |}.\+\nop| |
|000033f0| 20 20 20 20 20 20 20 7b | 64 72 61 77 73 20 61 6e | {|draws an|
|00003400| 20 65 64 67 65 20 66 72 | 6f 6d 20 24 73 24 2e 73 | edge fr|om $s$.s|
|00003410| 74 61 72 74 28 29 20 74 | 6f 20 24 73 24 2e 65 6e |tart() t|o $s$.en|
|00003420| 64 28 29 2e 7d 0a 5c 6d | 65 64 73 6b 69 70 0a 5c |d().}.\m|edskip.\|
|00003430| 2b 5c 6f 70 20 76 6f 69 | 64 20 64 72 61 77 5c 5f |+\op voi|d draw\_|
|00003440| 65 64 67 65 5c 5f 61 72 | 72 6f 77 20 7b 64 6f 75 |edge\_ar|row {dou|
|00003450| 62 6c 65 5c 20 20 78 5f | 31 2c 20 5c 20 64 6f 75 |ble\ x_|1, \ dou|
|00003460| 62 6c 65 5c 20 79 5f 31 | 2c 20 5c 20 64 6f 75 62 |ble\ y_1|, \ doub|
|00003470| 6c 65 5c 20 78 5f 32 2c | 20 5c 20 64 6f 75 62 6c |le\ x_2,| \ doubl|
|00003480| 65 5c 20 79 5f 32 2c 5c | 20 63 6f 6c 6f 72 5c 20 |e\ y_2,\| color\ |
|00003490| 63 20 3d 20 62 6c 61 63 | 6b 7d 20 7b 7d 0a 5c 2b |c = blac|k} {}.\+|
|000034a0| 5c 6e 6f 70 20 20 20 20 | 20 20 20 20 20 20 20 20 |\nop | |
|000034b0| 20 20 20 7b 64 72 61 77 | 73 20 61 20 64 69 72 65 | {draw|s a dire|
|000034c0| 63 74 65 64 20 65 64 67 | 65 20 66 72 6f 6d 20 24 |cted edg|e from $|
|000034d0| 28 78 5f 31 2c 79 5f 31 | 29 24 20 74 6f 20 24 28 |(x_1,y_1|)$ to $(|
|000034e0| 78 5f 32 2c 79 5f 32 29 | 24 2e 7d 0a 5c 6d 65 64 |x_2,y_2)|$.}.\med|
|000034f0| 73 6b 69 70 0a 5c 2b 5c | 6f 70 20 76 6f 69 64 20 |skip.\+\|op void |
|00003500| 64 72 61 77 5c 5f 65 64 | 67 65 5c 5f 61 72 72 6f |draw\_ed|ge\_arro|
|00003510| 77 20 7b 70 6f 69 6e 74 | 5c 20 70 2c 5c 20 70 6f |w {point|\ p,\ po|
|00003520| 69 6e 74 5c 20 71 2c 5c | 20 63 6f 6c 6f 72 5c 20 |int\ q,\| color\ |
|00003530| 63 20 3d 20 62 6c 61 63 | 6b 7d 20 7b 7d 0a 5c 2b |c = blac|k} {}.\+|
|00003540| 5c 6e 6f 70 20 20 20 20 | 20 20 20 20 20 20 20 20 |\nop | |
|00003550| 20 20 20 7b 64 72 61 77 | 73 20 61 20 64 69 72 65 | {draw|s a dire|
|00003560| 63 74 65 64 20 65 64 67 | 65 20 66 72 6f 6d 20 24 |cted edg|e from $|
|00003570| 70 24 20 74 6f 20 24 71 | 24 2e 7d 0a 5c 6d 65 64 |p$ to $q|$.}.\med|
|00003580| 73 6b 69 70 0a 5c 2b 5c | 6f 70 20 76 6f 69 64 20 |skip.\+\|op void |
|00003590| 64 72 61 77 5c 5f 65 64 | 67 65 5c 5f 61 72 72 6f |draw\_ed|ge\_arro|
|000035a0| 77 20 7b 73 65 67 6d 65 | 6e 74 5c 20 73 2c 5c 20 |w {segme|nt\ s,\ |
|000035b0| 63 6f 6c 6f 72 5c 20 63 | 20 3d 20 62 6c 61 63 6b |color\ c| = black|
|000035c0| 7d 20 7b 7d 0a 5c 2b 5c | 6e 6f 70 20 20 20 20 20 |} {}.\+\|nop |
|000035d0| 20 20 20 20 20 20 20 20 | 20 20 7b 64 72 61 77 73 | | {draws|
|000035e0| 20 61 20 64 69 72 65 63 | 74 65 64 20 65 64 67 65 | a direc|ted edge|
|000035f0| 20 66 72 6f 6d 20 24 73 | 24 2e 73 74 61 72 74 28 | from $s|$.start(|
|00003600| 29 20 74 6f 20 24 73 24 | 2e 65 6e 64 28 29 2e 7d |) to $s$|.end().}|
|00003610| 20 0a 0a 0a 0a 5c 62 69 | 67 73 6b 69 70 0a 7b 5c | ....\bi|gskip.{\|
|00003620| 62 66 20 33 2e 31 35 20 | 4d 6f 75 73 65 20 49 6e |bf 3.15 |Mouse In|
|00003630| 70 75 74 7d 0a 5c 62 69 | 67 73 6b 69 70 0a 5c 2b |put}.\bi|gskip.\+|
|00003640| 5c 6f 70 20 69 6e 74 20 | 20 20 72 65 61 64 5c 5f |\op int | read\_|
|00003650| 6d 6f 75 73 65 20 7b 7d | 0a 20 20 20 20 20 20 20 |mouse {}|. |
|00003660| 20 20 20 20 20 20 20 20 | 20 20 7b 64 69 73 70 6c | | {displ|
|00003670| 61 79 73 20 74 68 65 20 | 6d 6f 75 73 65 20 63 75 |ays the |mouse cu|
|00003680| 72 73 6f 72 20 75 6e 74 | 69 6c 20 61 20 62 75 74 |rsor unt|il a but|
|00003690| 74 6f 6e 20 69 73 20 70 | 72 65 73 73 65 64 2e 7d |ton is p|ressed.}|
|000036a0| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 20 20 20 20 20 |.\+\nop | |
|000036b0| 20 20 7b 52 65 74 75 72 | 6e 73 20 69 6e 74 65 67 | {Retur|ns integ|
|000036c0| 65 72 20 31 20 66 6f 72 | 20 74 68 65 20 6c 65 66 |er 1 for| the lef|
|000036d0| 74 2c 20 32 20 66 6f 72 | 20 74 68 65 20 6d 69 64 |t, 2 for| the mid|
|000036e0| 64 6c 65 2c 20 61 6e 64 | 7d 0a 5c 2b 5c 6e 6f 70 |dle, and|}.\+\nop|
|000036f0| 20 20 20 20 20 20 20 20 | 20 20 20 7b 33 20 66 6f | | {3 fo|
|00003700| 72 20 74 68 65 20 72 69 | 67 68 74 20 62 75 74 74 |r the ri|ght butt|
|00003710| 6f 6e 20 28 2d 31 2c 2d | 32 2c 2d 33 2c 20 69 66 |on (-1,-|2,-3, if|
|00003720| 20 74 68 65 20 73 68 69 | 66 74 20 6b 65 79 20 69 | the shi|ft key i|
|00003730| 73 7d 0a 5c 2b 5c 6e 6f | 70 20 20 20 20 20 20 20 |s}.\+\no|p |
|00003740| 20 20 20 20 7b 70 72 65 | 73 73 65 64 20 73 69 6d | {pre|ssed sim|
|00003750| 75 6c 74 61 6e 65 6f 75 | 73 6c 79 29 2e 7d 0a 5c |ultaneou|sly).}.\|
|00003760| 6d 65 64 73 6b 69 70 0a | 5c 2b 5c 6f 70 20 69 6e |medskip.|\+\op in|
|00003770| 74 20 20 20 72 65 61 64 | 5c 5f 6d 6f 75 73 65 20 |t read|\_mouse |
|00003780| 7b 64 6f 75 62 6c 65 5c | 26 5c 20 78 2c 5c 20 64 |{double\|&\ x,\ d|
|00003790| 6f 75 62 6c 65 5c 26 5c | 20 79 7d 20 20 7b 7d 0a |ouble\&\| y} {}.|
|000037a0| 5c 2b 5c 6e 6f 70 20 20 | 20 20 20 20 20 20 20 20 |\+\nop | |
|000037b0| 20 7b 64 69 73 70 6c 61 | 79 73 20 74 68 65 20 6d | {displa|ys the m|
|000037c0| 6f 75 73 65 20 63 75 72 | 73 6f 72 20 6f 6e 20 74 |ouse cur|sor on t|
|000037d0| 68 65 20 73 63 72 65 65 | 6e 20 75 6e 74 69 6c 20 |he scree|n until |
|000037e0| 61 7d 0a 5c 2b 5c 6e 6f | 70 20 20 20 20 20 20 20 |a}.\+\no|p |
|000037f0| 20 20 20 20 7b 62 75 74 | 74 6f 6e 20 69 73 20 70 | {but|ton is p|
|00003800| 72 65 73 73 65 64 2e 20 | 57 68 65 6e 20 61 20 62 |ressed. |When a b|
|00003810| 75 74 74 6f 6e 20 69 73 | 20 70 72 65 73 73 65 64 |utton is| pressed|
|00003820| 20 74 68 65 20 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 | the }.\|+\nop |
|00003830| 20 20 20 20 20 20 20 20 | 7b 63 75 72 72 65 6e 74 | |{current|
|00003840| 20 70 6f 73 69 74 69 6f | 6e 20 6f 66 20 74 68 65 | positio|n of the|
|00003850| 20 63 75 72 73 6f 72 20 | 69 73 20 61 73 73 69 67 | cursor |is assig|
|00003860| 6e 65 64 20 74 6f 20 7d | 0a 5c 2b 5c 6e 6f 70 20 |ned to }|.\+\nop |
|00003870| 20 20 20 20 20 20 20 20 | 20 20 7b 74 6f 20 24 28 | | {to $(|
|00003880| 78 2c 79 29 24 20 61 6e | 64 20 74 68 65 20 70 72 |x,y)$ an|d the pr|
|00003890| 65 73 73 65 64 20 62 75 | 74 74 6f 6e 20 69 73 20 |essed bu|tton is |
|000038a0| 72 65 74 75 72 6e 65 64 | 2e 7d 0a 5c 6d 65 64 73 |returned|.}.\meds|
|000038b0| 6b 69 70 0a 5c 2b 5c 6f | 70 20 69 6e 74 20 20 20 |kip.\+\o|p int |
|000038c0| 72 65 61 64 5c 5f 6d 6f | 75 73 65 5c 5f 73 65 67 |read\_mo|use\_seg|
|000038d0| 20 7b 64 6f 75 62 6c 65 | 5c 20 78 5f 30 2c 5c 20 | {double|\ x_0,\ |
|000038e0| 64 6f 75 62 6c 65 5c 20 | 79 5f 30 2c 5c 20 64 6f |double\ |y_0,\ do|
|000038f0| 75 62 6c 65 5c 26 5c 20 | 78 2c 5c 20 64 6f 75 62 |uble\&\ |x,\ doub|
|00003900| 6c 65 5c 26 5c 20 79 7d | 20 20 7b 7d 0a 5c 2b 5c |le\&\ y}| {}.\+\|
|00003910| 6e 6f 70 20 20 20 20 20 | 20 20 20 20 20 20 7b 64 |nop | {d|
|00003920| 69 73 70 6c 61 79 73 20 | 61 20 6c 69 6e 65 20 73 |isplays |a line s|
|00003930| 65 67 6d 65 6e 74 20 66 | 72 6f 6d 20 24 28 78 5f |egment f|rom $(x_|
|00003940| 30 2c 79 5f 30 29 24 20 | 74 6f 20 74 68 65 20 7d |0,y_0)$ |to the }|
|00003950| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 20 20 20 20 20 |.\+\nop | |
|00003960| 20 20 7b 63 75 72 72 65 | 6e 74 20 63 75 72 73 6f | {curre|nt curso|
|00003970| 72 20 70 6f 73 69 74 69 | 6f 6e 20 75 6e 74 69 6c |r positi|on until|
|00003980| 20 61 20 6d 6f 75 73 65 | 20 62 75 74 74 6f 6e 20 | a mouse| button |
|00003990| 69 73 7d 0a 5c 2b 5c 6e | 6f 70 20 20 20 20 20 20 |is}.\+\n|op |
|000039a0| 20 20 20 20 20 7b 70 72 | 65 73 73 65 64 2e 20 57 | {pr|essed. W|
|000039b0| 68 65 6e 20 61 20 62 75 | 74 74 6f 6e 20 69 73 20 |hen a bu|tton is |
|000039c0| 70 72 65 73 73 65 64 20 | 74 68 65 20 63 75 72 72 |pressed |the curr|
|000039d0| 65 6e 74 7d 0a 5c 2b 5c | 6e 6f 70 20 20 20 20 20 |ent}.\+\|nop |
|000039e0| 20 20 20 20 20 20 7b 70 | 6f 73 69 74 69 6f 6e 20 | {p|osition |
|000039f0| 69 73 20 61 73 73 69 67 | 6e 65 64 20 74 6f 20 24 |is assig|ned to $|
|00003a00| 28 78 2c 79 29 24 20 61 | 6e 64 20 74 68 65 20 70 |(x,y)$ a|nd the p|
|00003a10| 72 65 73 73 65 64 7d 0a | 5c 2b 5c 6e 6f 70 20 20 |ressed}.|\+\nop |
|00003a20| 20 20 20 20 20 20 20 20 | 20 7b 62 75 74 74 6f 6e | | {button|
|00003a30| 20 69 73 20 72 65 74 75 | 72 6e 65 64 2e 7d 0a 5c | is retu|rned.}.\|
|00003a40| 6d 65 64 73 6b 69 70 0a | 5c 2b 5c 6f 70 20 69 6e |medskip.|\+\op in|
|00003a50| 74 20 20 20 72 65 61 64 | 5c 5f 6d 6f 75 73 65 5c |t read|\_mouse\|
|00003a60| 5f 72 65 63 74 20 7b 64 | 6f 75 62 6c 65 5c 20 78 |_rect {d|ouble\ x|
|00003a70| 5f 30 2c 5c 20 64 6f 75 | 62 6c 65 5c 20 79 5f 30 |_0,\ dou|ble\ y_0|
|00003a80| 2c 5c 20 64 6f 75 62 6c | 65 5c 26 5c 20 78 2c 5c |,\ doubl|e\&\ x,\|
|00003a90| 20 64 6f 75 62 6c 65 5c | 26 5c 20 79 7d 20 20 7b | double\|&\ y} {|
|00003aa0| 7d 0a 5c 2b 5c 6e 6f 70 | 20 20 20 20 20 20 20 20 |}.\+\nop| |
|00003ab0| 20 20 20 7b 64 69 73 70 | 6c 61 79 73 20 61 20 72 | {disp|lays a r|
|00003ac0| 65 63 74 61 6e 67 6c 65 | 20 77 69 74 68 20 64 69 |ectangle| with di|
|00003ad0| 61 67 6f 6e 61 6c 20 66 | 72 6f 6d 20 24 28 78 5f |agonal f|rom $(x_|
|00003ae0| 30 2c 79 5f 30 29 24 7d | 0a 5c 2b 5c 6e 6f 70 20 |0,y_0)$}|.\+\nop |
|00003af0| 20 20 20 20 20 20 20 20 | 20 20 7b 74 6f 20 74 68 | | {to th|
|00003b00| 65 20 63 75 72 72 65 6e | 74 20 63 75 72 73 6f 72 |e curren|t cursor|
|00003b10| 20 70 6f 73 69 74 69 6f | 6e 20 75 6e 74 69 6c 20 | positio|n until |
|00003b20| 61 20 6d 6f 75 73 65 20 | 62 75 74 74 6f 6e 7d 0a |a mouse |button}.|
|00003b30| 5c 2b 5c 6e 6f 70 20 20 | 20 20 20 20 20 20 20 20 |\+\nop | |
|00003b40| 20 7b 69 73 20 70 72 65 | 73 73 65 64 2e 20 57 68 | {is pre|ssed. Wh|
|00003b50| 65 6e 20 61 20 62 75 74 | 74 6f 6e 20 69 73 20 70 |en a but|ton is p|
|00003b60| 72 65 73 73 65 64 20 74 | 68 65 20 63 75 72 72 65 |ressed t|he curre|
|00003b70| 6e 74 7d 0a 5c 2b 5c 6e | 6f 70 20 20 20 20 20 20 |nt}.\+\n|op |
|00003b80| 20 20 20 20 20 7b 70 6f | 73 69 74 69 6f 6e 20 69 | {po|sition i|
|00003b90| 73 20 61 73 73 69 67 6e | 65 64 20 74 6f 20 24 28 |s assign|ed to $(|
|00003ba0| 78 2c 79 29 24 20 61 6e | 64 20 74 68 65 20 70 72 |x,y)$ an|d the pr|
|00003bb0| 65 73 73 65 64 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 |essed}.\|+\nop |
|00003bc0| 20 20 20 20 20 20 20 20 | 7b 20 62 75 74 74 6f 6e | |{ button|
|00003bd0| 20 69 73 20 72 65 74 75 | 72 6e 65 64 2e 7d 0a 5c | is retu|rned.}.\|
|00003be0| 6d 65 64 73 6b 69 70 0a | 5c 2b 5c 6f 70 20 69 6e |medskip.|\+\op in|
|00003bf0| 74 20 20 20 72 65 61 64 | 5c 5f 6d 6f 75 73 65 5c |t read|\_mouse\|
|00003c00| 5f 63 69 72 63 6c 65 20 | 7b 64 6f 75 62 6c 65 5c |_circle |{double\|
|00003c10| 20 78 5f 30 2c 5c 20 64 | 6f 75 62 6c 65 5c 20 79 | x_0,\ d|ouble\ y|
|00003c20| 5f 30 2c 5c 20 64 6f 75 | 62 6c 65 5c 26 5c 20 78 |_0,\ dou|ble\&\ x|
|00003c30| 2c 5c 20 64 6f 75 62 6c | 65 5c 26 5c 20 79 7d 20 |,\ doubl|e\&\ y} |
|00003c40| 20 7b 7d 0a 5c 2b 5c 6e | 6f 70 20 20 20 20 20 20 | {}.\+\n|op |
|00003c50| 20 20 20 20 20 7b 64 69 | 73 70 6c 61 79 73 20 61 | {di|splays a|
|00003c60| 20 63 69 72 63 6c 65 20 | 77 69 74 68 20 63 65 6e | circle |with cen|
|00003c70| 74 65 72 20 24 28 78 5f | 30 2c 79 5f 30 29 24 20 |ter $(x_|0,y_0)$ |
|00003c80| 70 61 73 73 69 6e 67 7d | 0a 5c 2b 5c 6e 6f 70 20 |passing}|.\+\nop |
|00003c90| 20 20 20 20 20 20 20 20 | 20 20 7b 74 68 72 6f 75 | | {throu|
|00003ca0| 67 68 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 63 |gh the c|urrent c|
|00003cb0| 75 72 73 6f 72 20 70 6f | 73 69 74 69 6f 6e 20 75 |ursor po|sition u|
|00003cc0| 6e 74 69 6c 20 61 20 6d | 6f 75 73 65 7d 0a 5c 2b |ntil a m|ouse}.\+|
|00003cd0| 5c 6e 6f 70 20 20 20 20 | 20 20 20 20 20 20 20 7b |\nop | {|
|00003ce0| 62 75 74 74 6f 6e 20 69 | 73 20 70 72 65 73 73 65 |button i|s presse|
|00003cf0| 64 2e 20 57 68 65 6e 20 | 61 20 62 75 74 74 6f 6e |d. When |a button|
|00003d00| 20 69 73 20 70 72 65 73 | 73 65 64 20 74 68 65 7d | is pres|sed the}|
|00003d10| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 20 20 20 20 20 |.\+\nop | |
|00003d20| 20 20 7b 63 75 72 72 65 | 6e 74 20 70 6f 73 69 74 | {curre|nt posit|
|00003d30| 69 6f 6e 20 69 73 20 61 | 73 73 69 67 6e 65 64 20 |ion is a|ssigned |
|00003d40| 74 6f 20 24 28 78 2c 79 | 29 24 20 61 6e 64 20 74 |to $(x,y|)$ and t|
|00003d50| 68 65 7d 0a 5c 2b 5c 6e | 6f 70 20 20 20 20 20 20 |he}.\+\n|op |
|00003d60| 20 20 20 20 20 7b 70 72 | 65 73 73 65 64 20 62 75 | {pr|essed bu|
|00003d70| 74 74 6f 6e 20 69 73 20 | 72 65 74 75 72 6e 65 64 |tton is |returned|
|00003d80| 2e 7d 0a 5c 6d 65 64 73 | 6b 69 70 0a 5c 2b 5c 6f |.}.\meds|kip.\+\o|
|00003d90| 70 20 62 6f 6f 6c 20 20 | 63 6f 6e 66 69 72 6d 20 |p bool |confirm |
|00003da0| 7b 73 74 72 69 6e 67 5c | 20 73 7d 20 0a 20 20 20 |{string\| s} . |
|00003db0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 7b 64 | | {d|
|00003dc0| 69 73 70 6c 61 79 73 20 | 73 74 72 69 6e 67 20 24 |isplays |string $|
|00003dd0| 73 24 20 61 6e 64 20 61 | 73 6b 73 20 66 6f 72 20 |s$ and a|sks for |
|00003de0| 63 6f 6e 66 69 72 6d 61 | 74 69 6f 6e 2e 7d 0a 5c |confirma|tion.}.\|
|00003df0| 2b 5c 6e 6f 70 20 20 20 | 20 20 20 20 20 20 20 20 |+\nop | |
|00003e00| 7b 52 65 74 75 72 6e 73 | 20 74 72 75 65 20 69 66 |{Returns| true if|
|00003e10| 66 20 74 68 65 20 61 6e | 73 77 65 72 20 77 61 73 |f the an|swer was|
|00003e20| 20 60 60 79 65 73 27 27 | 2e 7d 0a 5c 6d 65 64 73 | ``yes''|.}.\meds|
|00003e30| 6b 69 70 0a 5c 2b 5c 6f | 70 20 76 6f 69 64 20 61 |kip.\+\o|p void a|
|00003e40| 63 6b 6e 6f 77 6c 65 64 | 67 65 20 7b 73 74 72 69 |cknowled|ge {stri|
|00003e50| 6e 67 5c 20 73 7d 20 7b | 7d 0a 5c 2b 5c 6e 6f 70 |ng\ s} {|}.\+\nop|
|00003e60| 20 20 20 20 20 20 20 20 | 20 20 20 7b 64 69 73 70 | | {disp|
|00003e70| 6c 61 79 73 20 73 74 72 | 69 6e 67 20 24 73 24 20 |lays str|ing $s$ |
|00003e80| 61 6e 64 20 61 73 6b 73 | 20 66 6f 72 20 61 63 6b |and asks| for ack|
|00003e90| 6e 6f 77 6c 65 64 67 65 | 6d 65 6e 74 2e 7d 0a 5c |nowledge|ment.}.\|
|00003ea0| 6d 65 64 73 6b 69 70 0a | 5c 2b 5c 6f 70 20 69 6e |medskip.|\+\op in|
|00003eb0| 74 20 20 72 65 61 64 5c | 5f 70 61 6e 65 6c 20 7b |t read\|_panel {|
|00003ec0| 73 74 72 69 6e 67 5c 20 | 68 2c 5c 20 69 6e 74 5c |string\ |h,\ int\|
|00003ed0| 20 6e 2c 5c 20 73 74 72 | 69 6e 67 2a 5c 20 53 7d | n,\ str|ing*\ S}|
|00003ee0| 20 7b 7d 0a 5c 2b 5c 6e | 6f 70 20 20 20 20 20 20 | {}.\+\n|op |
|00003ef0| 20 20 20 20 20 7b 64 69 | 73 70 6c 61 79 73 20 61 | {di|splays a|
|00003f00| 20 70 61 6e 65 6c 20 77 | 69 74 68 20 68 65 61 64 | panel w|ith head|
|00003f10| 65 72 20 24 68 24 20 61 | 6e 64 20 61 6e 20 61 72 |er $h$ a|nd an ar|
|00003f20| 72 61 79 20 24 53 5b 31 | 2e 2e 6e 5d 24 20 7d 0a |ray $S[1|..n]$ }.|
|00003f30| 5c 2b 5c 6e 6f 70 20 20 | 20 20 20 20 20 20 20 20 |\+\nop | |
|00003f40| 20 7b 6f 66 20 24 6e 24 | 20 73 74 72 69 6e 67 20 | {of $n$| string |
|00003f50| 62 75 74 74 6f 6e 73 2c | 20 72 65 74 75 72 6e 73 |buttons,| returns|
|00003f60| 20 74 68 65 20 69 6e 64 | 65 78 20 6f 66 20 74 68 | the ind|ex of th|
|00003f70| 65 20 73 65 6c 65 63 74 | 65 64 7d 0a 5c 2b 5c 6e |e select|ed}.\+\n|
|00003f80| 6f 70 20 20 20 20 20 20 | 20 20 20 20 20 7b 62 75 |op | {bu|
|00003f90| 74 74 6f 6e 2e 7d 0a 5c | 6d 65 64 73 6b 69 70 0a |tton.}.\|medskip.|
|00003fa0| 5c 2b 5c 6f 70 20 69 6e | 74 20 20 72 65 61 64 5c |\+\op in|t read\|
|00003fb0| 5f 76 70 61 6e 65 6c 20 | 7b 73 74 72 69 6e 67 5c |_vpanel |{string\|
|00003fc0| 20 68 2c 5c 20 69 6e 74 | 5c 20 6e 2c 5c 20 73 74 | h,\ int|\ n,\ st|
|00003fd0| 72 69 6e 67 2a 5c 20 53 | 7d 20 7b 7d 0a 5c 2b 5c |ring*\ S|} {}.\+\|
|00003fe0| 6e 6f 70 20 20 20 20 20 | 20 20 20 20 20 20 7b 6c |nop | {l|
|00003ff0| 69 6b 65 20 72 65 61 64 | 5c 5f 70 61 6e 65 6c 20 |ike read|\_panel |
|00004000| 77 69 74 68 20 76 65 72 | 74 69 63 61 6c 20 62 75 |with ver|tical bu|
|00004010| 74 74 6f 6e 20 6c 61 79 | 6f 75 74 7d 0a 5c 6d 65 |tton lay|out}.\me|
|00004020| 64 73 6b 69 70 0a 5c 2b | 5c 6f 70 20 69 6e 74 20 |dskip.\+|\op int |
|00004030| 20 72 65 61 64 5c 5f 69 | 6e 74 20 7b 73 74 72 69 | read\_i|nt {stri|
|00004040| 6e 67 5c 20 70 7d 20 7b | 7d 0a 5c 2b 5c 6e 6f 70 |ng\ p} {|}.\+\nop|
|00004050| 20 20 20 20 20 20 20 20 | 20 20 20 7b 64 69 73 70 | | {disp|
|00004060| 6c 61 79 73 20 61 20 70 | 61 6e 65 6c 20 77 69 74 |lays a p|anel wit|
|00004070| 68 20 70 72 6f 6d 70 74 | 20 24 70 24 20 66 6f 72 |h prompt| $p$ for|
|00004080| 20 69 6e 74 65 67 65 72 | 20 69 6e 70 75 74 2c 7d | integer| input,}|
|00004090| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 20 20 20 20 20 |.\+\nop | |
|000040a0| 20 20 7b 72 65 74 75 72 | 6e 73 20 74 68 65 20 69 | {retur|ns the i|
|000040b0| 6e 70 75 74 7d 0a 5c 6d | 65 64 73 6b 69 70 0a 5c |nput}.\m|edskip.\|
|000040c0| 2b 5c 6f 70 20 64 6f 75 | 62 6c 65 20 20 72 65 61 |+\op dou|ble rea|
|000040d0| 64 5c 5f 72 65 61 6c 20 | 7b 73 74 72 69 6e 67 5c |d\_real |{string\|
|000040e0| 20 70 7d 20 7b 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 | p} {}.\|+\nop |
|000040f0| 20 20 20 20 20 20 20 20 | 7b 64 69 73 70 6c 61 79 | |{display|
|00004100| 73 20 61 20 70 61 6e 65 | 6c 20 77 69 74 68 20 70 |s a pane|l with p|
|00004110| 72 6f 6d 70 74 20 24 70 | 24 20 66 6f 72 20 72 65 |rompt $p|$ for re|
|00004120| 61 6c 20 69 6e 70 75 74 | 7d 0a 5c 2b 5c 6e 6f 70 |al input|}.\+\nop|
|00004130| 20 20 20 20 20 20 20 20 | 20 20 20 7b 72 65 74 75 | | {retu|
|00004140| 72 6e 73 20 74 68 65 20 | 69 6e 70 75 74 7d 0a 5c |rns the |input}.\|
|00004150| 6d 65 64 73 6b 69 70 0a | 5c 2b 5c 6f 70 20 73 74 |medskip.|\+\op st|
|00004160| 72 69 6e 67 20 20 72 65 | 61 64 5c 5f 73 74 72 69 |ring re|ad\_stri|
|00004170| 6e 67 20 7b 73 74 72 69 | 6e 67 5c 20 70 7d 20 7b |ng {stri|ng\ p} {|
|00004180| 7d 0a 5c 2b 5c 6e 6f 70 | 20 20 20 20 20 20 20 20 |}.\+\nop| |
|00004190| 20 20 20 7b 64 69 73 70 | 6c 61 79 73 20 61 20 70 | {disp|lays a p|
|000041a0| 61 6e 65 6c 20 77 69 74 | 68 20 70 72 6f 6d 70 74 |anel wit|h prompt|
|000041b0| 20 24 70 24 20 66 6f 72 | 20 73 74 72 69 6e 67 20 | $p$ for| string |
|000041c0| 69 6e 70 75 74 2c 7d 0a | 5c 2b 5c 6e 6f 70 20 20 |input,}.|\+\nop |
|000041d0| 20 20 20 20 20 20 20 20 | 20 7b 72 65 74 75 72 6e | | {return|
|000041e0| 73 20 74 68 65 20 69 6e | 70 75 74 7d 0a 5c 6d 65 |s the in|put}.\me|
|000041f0| 64 73 6b 69 70 0a 5c 2b | 5c 6f 70 20 76 6f 69 64 |dskip.\+|\op void|
|00004200| 20 20 6d 65 73 73 61 67 | 65 20 7b 73 74 72 69 6e | messag|e {strin|
|00004210| 67 5c 20 73 7d 20 0a 20 | 20 20 20 20 20 20 20 20 |g\ s} . | |
|00004220| 20 20 20 20 20 20 20 20 | 7b 64 69 73 70 6c 61 79 | |{display|
|00004230| 73 20 6d 65 73 73 61 67 | 65 20 24 73 24 20 28 65 |s messag|e $s$ (e|
|00004240| 61 63 68 20 63 61 6c 6c | 20 61 64 64 73 20 61 20 |ach call| adds a |
|00004250| 6e 65 77 20 6c 69 6e 65 | 29 2e 7d 0a 5c 6d 65 64 |new line|).}.\med|
|00004260| 73 6b 69 70 0a 5c 2b 5c | 6f 70 20 76 6f 69 64 20 |skip.\+\|op void |
|00004270| 20 64 65 6c 5c 5f 6d 65 | 73 73 61 67 65 20 7b 7d | del\_me|ssage {}|
|00004280| 20 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | . | |
|00004290| 20 20 20 7b 64 65 6c 65 | 74 65 73 20 74 68 65 20 | {dele|tes the |
|000042a0| 74 65 78 74 20 77 72 69 | 74 74 65 6e 20 62 79 20 |text wri|tten by |
|000042b0| 61 6c 6c 20 70 72 65 76 | 69 6f 75 73 20 6d 65 73 |all prev|ious mes|
|000042c0| 73 61 67 65 7d 0a 5c 2b | 5c 6e 6f 70 20 20 20 20 |sage}.\+|\nop |
|000042d0| 20 20 20 20 20 20 20 7b | 6f 70 65 72 61 74 69 6f | {|operatio|
|000042e0| 6e 73 2e 7d 0a 5c 6d 65 | 64 73 6b 69 70 0a 0a 5c |ns.}.\me|dskip..\|
|000042f0| 76 66 69 6c 6c 5c 65 6a | 65 63 74 0a 0a 5c 62 69 |vfill\ej|ect..\bi|
|00004300| 67 73 6b 69 70 0a 7b 5c | 62 66 20 33 2e 31 36 20 |gskip.{\|bf 3.16 |
|00004310| 49 6e 70 75 74 20 61 6e | 64 20 6f 75 74 70 75 74 |Input an|d output|
|00004320| 20 6f 70 65 72 61 74 6f | 72 73 7d 0a 0a 46 6f 72 | operato|rs}..For|
|00004330| 20 69 6e 70 75 74 20 61 | 6e 64 20 6f 75 74 70 75 | input a|nd outpu|
|00004340| 74 20 6f 66 20 62 61 73 | 69 63 20 67 65 6f 6d 65 |t of bas|ic geome|
|00004350| 74 72 69 63 20 6f 62 6a | 65 63 74 73 20 69 6e 20 |tric obj|ects in |
|00004360| 74 68 65 20 70 6c 61 6e | 65 20 73 75 63 68 20 61 |the plan|e such a|
|00004370| 73 20 70 6f 69 6e 74 73 | 2c 20 0a 6c 69 6e 65 73 |s points|, .lines|
|00004380| 2c 20 6c 69 6e 65 20 73 | 65 67 6d 65 6e 74 73 2c |, line s|egments,|
|00004390| 20 63 69 72 63 6c 65 73 | 2c 20 61 6e 64 20 70 6f | circles|, and po|
|000043a0| 6c 79 67 6f 6e 73 20 74 | 68 65 20 24 3c 3c 24 20 |lygons t|he $<<$ |
|000043b0| 61 6e 64 20 24 3e 3e 24 | 20 6f 70 65 72 61 74 6f |and $>>$| operato|
|000043c0| 72 73 20 63 61 6e 20 0a | 62 65 20 75 73 65 64 2e |rs can .|be used.|
|000043d0| 20 53 69 6d 69 6c 61 72 | 20 74 6f 20 5c 43 43 20 | Similar| to \CC |
|000043e0| 69 6e 70 75 74 20 73 74 | 72 65 61 6d 73 20 77 69 |input st|reams wi|
|000043f0| 6e 64 6f 77 73 20 68 61 | 76 65 20 61 6e 20 69 6e |ndows ha|ve an in|
|00004400| 74 65 72 6e 61 6c 20 73 | 74 61 74 65 20 69 6e 64 |ternal s|tate ind|
|00004410| 69 63 61 74 69 6e 67 0a | 77 68 65 74 68 65 72 20 |icating.|whether |
|00004420| 74 68 65 72 65 20 69 73 | 20 6d 6f 72 65 20 69 6e |there is| more in|
|00004430| 70 75 74 20 74 6f 20 72 | 65 61 64 20 6f 72 20 6e |put to r|ead or n|
|00004440| 6f 74 2e 20 49 74 73 20 | 69 6e 69 74 69 61 6c 20 |ot. Its |initial |
|00004450| 76 61 6c 75 65 20 69 73 | 20 74 72 75 65 20 61 6e |value is| true an|
|00004460| 64 20 69 74 20 0a 69 73 | 20 74 75 72 6e 65 64 20 |d it .is| turned |
|00004470| 74 6f 20 66 61 6c 73 65 | 20 69 66 20 61 6e 20 69 |to false| if an i|
|00004480| 6e 70 75 74 20 73 65 71 | 75 65 6e 63 65 20 69 73 |nput seq|uence is|
|00004490| 20 74 65 72 6d 69 6e 61 | 74 65 64 20 20 62 79 20 | termina|ted by |
|000044a0| 63 6c 69 63 6b 69 6e 67 | 20 74 68 65 20 72 69 67 |clicking| the rig|
|000044b0| 68 74 20 0a 6d 6f 75 73 | 65 20 62 75 74 74 6f 6e |ht .mous|e button|
|000044c0| 20 28 73 69 6d 69 6c 61 | 72 20 74 6f 20 65 6e 64 | (simila|r to end|
|000044d0| 69 6e 67 20 73 74 72 65 | 61 6d 20 69 6e 70 75 74 |ing stre|am input|
|000044e0| 20 62 79 20 74 68 65 20 | 65 6f 66 20 63 68 61 72 | by the |eof char|
|000044f0| 61 63 74 65 72 29 2e 20 | 49 6e 20 0a 63 6f 6e 64 |acter). |In .cond|
|00004500| 69 74 69 6f 6e 61 6c 20 | 73 74 61 74 65 6d 65 6e |itional |statemen|
|00004510| 74 73 20 6f 62 6a 65 63 | 74 73 20 6f 66 20 74 79 |ts objec|ts of ty|
|00004520| 70 65 20 24 77 69 6e 64 | 6f 77 24 20 61 72 65 20 |pe $wind|ow$ are |
|00004530| 61 75 74 6f 6d 61 74 69 | 63 61 6c 6c 79 20 63 6f |automati|cally co|
|00004540| 6e 76 65 72 74 65 64 20 | 0a 74 6f 20 62 6f 6f 6c |nverted |.to bool|
|00004550| 65 61 6e 20 62 79 20 72 | 65 74 75 72 6e 69 6e 67 |ean by r|eturning|
|00004560| 20 74 68 69 73 20 69 6e | 74 65 72 6e 61 6c 20 73 | this in|ternal s|
|00004570| 74 61 74 65 2e 20 54 68 | 75 73 2c 20 74 68 65 79 |tate. Th|us, they|
|00004580| 20 63 61 6e 20 62 65 20 | 75 73 65 64 20 69 6e 20 | can be |used in |
|00004590| 0a 63 6f 6e 64 69 74 69 | 6f 6e 61 6c 20 73 74 61 |.conditi|onal sta|
|000045a0| 74 65 6d 65 6e 74 73 20 | 69 6e 20 74 68 65 20 73 |tements |in the s|
|000045b0| 61 6d 65 20 77 61 79 20 | 61 73 20 5c 43 43 20 69 |ame way |as \CC i|
|000045c0| 6e 70 75 74 20 73 74 72 | 65 61 6d 73 2e 20 46 6f |nput str|eams. Fo|
|000045d0| 72 20 65 78 61 6d 70 6c | 65 2c 0a 74 6f 20 72 65 |r exampl|e,.to re|
|000045e0| 61 64 20 61 20 73 65 71 | 75 65 6e 63 65 20 6f 66 |ad a seq|uence of|
|000045f0| 20 70 6f 69 6e 74 73 20 | 74 65 72 6d 69 6e 61 74 | points |terminat|
|00004600| 65 64 20 62 79 20 61 20 | 72 69 67 68 74 20 62 75 |ed by a |right bu|
|00004610| 74 74 6f 6e 20 63 6c 69 | 63 6b 2c 20 20 75 73 65 |tton cli|ck, use|
|00004620| 20 0a 60 60 20 7b 5c 62 | 66 20 77 68 69 6c 65 7d | .`` {\b|f while}|
|00004630| 20 28 24 57 5c 20 3e 3e | 5c 20 70 24 29 20 24 5c | ($W\ >>|\ p$) $\|
|00004640| 7b 5c 20 20 5c 64 6f 74 | 73 5c 20 5c 7d 24 20 27 |{\ \dot|s\ \}$ '|
|00004650| 27 2e 20 0a 0a 0a 7b 5c | 62 66 20 33 2e 31 36 2e |'. ...{\|bf 3.16.|
|00004660| 31 20 4f 75 74 70 75 74 | 7d 0a 5c 73 6d 61 6c 6c |1 Output|}.\small|
|00004670| 73 6b 69 70 0a 5c 63 6c | 65 61 72 74 61 62 73 0a |skip.\cl|eartabs.|
|00004680| 5c 2b 26 5c 68 73 6b 69 | 70 20 33 74 72 75 65 63 |\+&\hski|p 3truec|
|00004690| 6d 20 20 20 20 20 20 26 | 5c 68 73 6b 69 70 20 34 |m &|\hskip 4|
|000046a0| 74 72 75 65 63 6d 20 26 | 5c 63 72 0a 5c 2b 5c 6f |truecm &|\cr.\+\o|
|000046b0| 70 62 20 77 69 6e 64 6f | 77 5c 26 20 3c 3c 20 7b |pb windo|w\& << {|
|000046c0| 70 6f 69 6e 74 5c 20 70 | 7d 20 20 20 20 20 0a 20 |point\ p|} . |
|000046d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000046e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000046f0| 20 20 7b 6c 69 6b 65 20 | 24 57 24 2e 64 72 61 77 | {like |$W$.draw|
|00004700| 5c 5f 70 6f 69 6e 74 28 | 24 70 24 29 7d 0a 5c 6d |\_point(|$p$)}.\m|
|00004710| 65 64 73 6b 69 70 0a 5c | 2b 5c 6f 70 62 20 77 69 |edskip.\|+\opb wi|
|00004720| 6e 64 6f 77 5c 26 20 3c | 3c 20 7b 73 65 67 6d 65 |ndow\& <|< {segme|
|00004730| 6e 74 5c 20 73 7d 20 20 | 20 0a 20 20 20 20 20 20 |nt\ s} | . |
|00004740| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004750| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 7b 6c 69 | | {li|
|00004760| 6b 65 20 24 57 24 2e 64 | 72 61 77 5c 5f 73 65 67 |ke $W$.d|raw\_seg|
|00004770| 6d 65 6e 74 28 24 73 24 | 29 7d 0a 5c 6d 65 64 73 |ment($s$|)}.\meds|
|00004780| 6b 69 70 0a 5c 2b 5c 6f | 70 62 20 77 69 6e 64 6f |kip.\+\o|pb windo|
|00004790| 77 5c 26 20 3c 3c 20 7b | 6c 69 6e 65 5c 20 6c 7d |w\& << {|line\ l}|
|000047a0| 20 20 20 20 20 20 0a 20 | 20 20 20 20 20 20 20 20 | . | |
|000047b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000047c0| 20 20 20 20 20 20 20 20 | 20 20 7b 6c 69 6b 65 20 | | {like |
|000047d0| 24 57 24 2e 64 72 61 77 | 5c 5f 6c 69 6e 65 28 24 |$W$.draw|\_line($|
|000047e0| 6c 24 29 7d 0a 5c 6d 65 | 64 73 6b 69 70 0a 5c 2b |l$)}.\me|dskip.\+|
|000047f0| 5c 6f 70 62 20 77 69 6e | 64 6f 77 5c 26 20 3c 3c |\opb win|dow\& <<|
|00004800| 20 7b 63 69 72 63 6c 65 | 5c 20 43 7d 20 20 20 20 | {circle|\ C} |
|00004810| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00004820| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004830| 20 20 20 20 7b 6c 69 6b | 65 20 24 57 24 2e 64 72 | {lik|e $W$.dr|
|00004840| 61 77 5c 5f 63 69 72 63 | 6c 65 28 24 43 24 29 7d |aw\_circ|le($C$)}|
|00004850| 0a 5c 6d 65 64 73 6b 69 | 70 0a 5c 2b 5c 6f 70 62 |.\medski|p.\+\opb|
|00004860| 20 77 69 6e 64 6f 77 5c | 26 20 3c 3c 20 7b 70 6f | window\|& << {po|
|00004870| 6c 79 67 6f 6e 5c 20 50 | 7d 20 20 20 0a 20 20 20 |lygon\ P|} . |
|00004880| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004890| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000048a0| 7b 6c 69 6b 65 20 24 57 | 24 2e 64 72 61 77 5c 5f |{like $W|$.draw\_|
|000048b0| 70 6f 6c 79 67 6f 6e 28 | 24 50 24 29 7d 0a 5c 6d |polygon(|$P$)}.\m|
|000048c0| 65 64 73 6b 69 70 0a 0a | 0a 5c 62 69 67 73 6b 69 |edskip..|.\bigski|
|000048d0| 70 0a 7b 5c 62 66 20 33 | 2e 31 36 2e 32 20 49 6e |p.{\bf 3|.16.2 In|
|000048e0| 70 75 74 7d 0a 5c 6d 65 | 64 73 6b 69 70 0a 5c 2b |put}.\me|dskip.\+|
|000048f0| 5c 6f 70 62 20 77 69 6e | 64 6f 77 5c 26 20 3e 3e |\opb win|dow\& >>|
|00004900| 20 70 20 20 20 0a 20 20 | 20 20 20 20 20 20 20 20 | p . | |
|00004910| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004920| 20 7b 72 65 61 64 73 20 | 61 20 70 6f 69 6e 74 20 | {reads |a point |
|00004930| 24 70 24 3a 20 63 6c 69 | 63 6b 69 6e 67 20 74 68 |$p$: cli|cking th|
|00004940| 65 20 6c 65 66 74 20 62 | 75 74 74 6f 6e 7d 0a 5c |e left b|utton}.\|
|00004950| 2b 5c 6e 6f 70 20 20 20 | 20 20 20 20 20 20 20 20 |+\nop | |
|00004960| 20 20 20 20 20 20 20 20 | 20 20 7b 61 73 73 69 67 | | {assig|
|00004970| 6e 73 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 63 |ns the c|urrent c|
|00004980| 75 72 73 6f 72 20 70 6f | 73 69 74 69 6f 6e 20 74 |ursor po|sition t|
|00004990| 6f 20 24 70 24 2e 7d 0a | 5c 6d 65 64 73 6b 69 70 |o $p$.}.|\medskip|
|000049a0| 0a 5c 2b 5c 6f 70 62 20 | 77 69 6e 64 6f 77 5c 26 |.\+\opb |window\&|
|000049b0| 20 3e 3e 20 73 20 20 20 | 0a 20 20 20 20 20 20 20 | >> s |. |
|000049c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000049d0| 20 20 20 20 7b 72 65 61 | 64 73 20 61 20 73 65 67 | {rea|ds a seg|
|000049e0| 6d 65 6e 74 20 24 73 24 | 3a 20 75 73 65 20 74 68 |ment $s$|: use th|
|000049f0| 65 20 6c 65 66 74 20 62 | 75 74 74 6f 6e 20 74 6f |e left b|utton to|
|00004a00| 20 69 6e 70 75 74 7d 0a | 5c 2b 5c 6e 6f 70 20 20 | input}.|\+\nop |
|00004a10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004a20| 20 20 20 7b 74 68 65 20 | 73 74 61 72 74 20 61 6e | {the |start an|
|00004a30| 64 20 65 6e 64 20 70 6f | 69 6e 74 20 6f 66 20 24 |d end po|int of $|
|00004a40| 73 24 2e 7d 0a 5c 6d 65 | 64 73 6b 69 70 0a 5c 2b |s$.}.\me|dskip.\+|
|00004a50| 5c 6f 70 62 20 77 69 6e | 64 6f 77 5c 26 20 3e 3e |\opb win|dow\& >>|
|00004a60| 20 6c 20 20 20 0a 20 20 | 20 20 20 20 20 20 20 20 | l . | |
|00004a70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004a80| 20 7b 72 65 61 64 73 20 | 61 20 6c 69 6e 65 20 24 | {reads |a line $|
|00004a90| 6c 24 3a 20 75 73 65 20 | 74 68 65 20 6c 65 66 74 |l$: use |the left|
|00004aa0| 20 62 75 74 74 6f 6e 20 | 74 6f 20 69 6e 70 75 74 | button |to input|
|00004ab0| 7d 0a 5c 2b 5c 6e 6f 70 | 20 20 20 20 20 20 20 20 |}.\+\nop| |
|00004ac0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 7b 74 77 | | {tw|
|00004ad0| 6f 20 64 69 66 66 65 72 | 65 6e 74 20 70 6f 69 6e |o differ|ent poin|
|00004ae0| 74 73 20 6f 6e 20 24 6c | 24 7d 0a 5c 6d 65 64 73 |ts on $l|$}.\meds|
|00004af0| 6b 69 70 0a 5c 2b 5c 6f | 70 62 20 77 69 6e 64 6f |kip.\+\o|pb windo|
|00004b00| 77 5c 26 20 3e 3e 20 43 | 20 20 20 0a 20 20 20 20 |w\& >> C| . |
|00004b10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004b20| 20 20 20 20 20 20 20 7b | 72 65 61 64 73 20 61 20 | {|reads a |
|00004b30| 63 69 72 63 6c 65 20 24 | 43 24 3a 20 75 73 65 20 |circle $|C$: use |
|00004b40| 74 68 65 20 6c 65 66 74 | 20 62 75 74 74 6f 6e 20 |the left| button |
|00004b50| 74 6f 20 69 6e 70 75 74 | 7d 0a 5c 2b 5c 6e 6f 70 |to input|}.\+\nop|
|00004b60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004b70| 20 20 20 20 20 7b 74 68 | 65 20 63 65 6e 74 65 72 | {th|e center|
|00004b80| 20 6f 66 20 24 43 24 20 | 61 6e 64 20 61 20 70 6f | of $C$ |and a po|
|00004b90| 69 6e 74 20 6f 6e 20 24 | 43 24 7d 0a 5c 6d 65 64 |int on $|C$}.\med|
|00004ba0| 73 6b 69 70 0a 5c 2b 5c | 6f 70 62 20 77 69 6e 64 |skip.\+\|opb wind|
|00004bb0| 6f 77 5c 26 20 3e 3e 20 | 50 20 20 20 0a 20 20 20 |ow\& >> |P . |
|00004bc0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004bd0| 20 20 20 20 20 20 20 20 | 7b 72 65 61 64 73 20 61 | |{reads a|
|00004be0| 20 70 6f 6c 79 67 6f 6e | 20 24 50 24 3a 20 75 73 | polygon| $P$: us|
|00004bf0| 65 20 74 68 65 20 6c 65 | 66 74 20 62 75 74 74 6f |e the le|ft butto|
|00004c00| 6e 20 74 6f 20 69 6e 70 | 75 74 7d 0a 5c 2b 5c 6e |n to inp|ut}.\+\n|
|00004c10| 6f 70 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |op | |
|00004c20| 20 20 20 20 20 20 20 7b | 74 68 65 20 73 65 71 75 | {|the sequ|
|00004c30| 65 6e 63 65 20 6f 66 20 | 76 65 72 74 69 63 65 73 |ence of |vertices|
|00004c40| 20 6f 66 20 24 50 24 2c | 20 65 6e 64 20 74 68 65 | of $P$,| end the|
|00004c50| 20 73 65 71 75 65 6e 63 | 65 7d 0a 5c 2b 5c 6e 6f | sequenc|e}.\+\no|
|00004c60| 70 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |p | |
|00004c70| 20 20 20 20 20 20 7b 62 | 79 20 63 6c 69 63 6b 69 | {b|y clicki|
|00004c80| 6e 67 20 74 68 65 20 6d | 69 64 64 6c 65 20 62 75 |ng the m|iddle bu|
|00004c90| 74 74 6f 6e 2e 7d 0a 5c | 6d 65 64 73 6b 69 70 0a |tton.}.\|medskip.|
|00004ca0| 0a 41 73 20 6c 6f 6e 67 | 20 61 73 20 61 6e 20 69 |.As long| as an i|
|00004cb0| 6e 70 75 74 20 6f 70 65 | 72 61 74 69 6f 6e 20 68 |nput ope|ration h|
|00004cc0| 61 73 20 6e 6f 74 20 62 | 65 65 6e 20 63 6f 6d 70 |as not b|een comp|
|00004cd0| 6c 65 74 65 64 20 74 68 | 65 20 6c 61 73 74 20 72 |leted th|e last r|
|00004ce0| 65 61 64 20 70 6f 69 6e | 74 20 63 61 6e 20 0a 62 |ead poin|t can .b|
|00004cf0| 65 20 65 72 61 73 65 64 | 20 62 79 20 73 69 6d 75 |e erased| by simu|
|00004d00| 6c 74 61 6e 65 6f 75 73 | 6c 79 20 70 72 65 73 73 |ltaneous|ly press|
|00004d10| 69 6e 67 20 74 68 65 20 | 73 68 69 66 74 20 6b 65 |ing the |shift ke|
|00004d20| 79 20 61 6e 64 20 74 68 | 65 20 6c 65 66 74 20 6d |y and th|e left m|
|00004d30| 6f 75 73 65 20 62 75 74 | 74 6f 6e 2e 0a 0a |ouse but|ton... |
+--------+-------------------------+-------------------------+--------+--------+